// ==UserScript==
// @name           Mig[VK]Script
// @namespace      http://vkontakte.ru/
// @description    Полезные фичи для [в]контакте
// @author         Mr_Mig
// @version        0.14.10
// @copyright      2009+, Mr_Mig (http://vkontakte.ru/id4518704)
// @license        Beerware
// @include http://*vkontakte.ru/*
// @include http://*vk.com/*
// @include http://vk.hamlab.net/*
// @exclude http://vkontakte.ru/login*
// @exclude http://vk.com/login*
// @exclude http://login.vk.com/*
// ==/UserScript==

/*
 * ----------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42):
 * <migfiziki@gmail.com> wrote this file. As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return. Mr_Mig
 * ----------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42):
 * <migfiziki@gmail.com> написал сей скрипт. Вы можете использовать этот код
 * как пожелаете и для любых целей при условии, что вы сохраните эту заметку.
 * Если мы когда-либо встретимся, и вы считаете, что данный скрипт вам полезен,
 * вы можете купить мне пиво, либо выпить за мое здоровье. Mr_Mig
 * ----------------------------------------------------------------------------
 */



/*
 Поправлены стили
 Переделан движок оповещений
 Настройка анимации (можно отключить)
 Ссылка на новое сообщение в оповещении
 Новый стиль в контейнерах
 */

// СКРИПТ

var MigScript = {
    SCRIPT_VERSION: "0.14.10",
    HOST : "http://vk.com",
    CSS_HOST : "http://vk.hamlab.net",
    DEBUG : false,
    myUid : null,
    opera : /opera/.test(navigator.userAgent.toLowerCase()),
    purge: null,
    log : function(msg) {
        if (MigScript.DEBUG) {
            console.log(msg);
        }
    },
    alert : function(caption, msg, classPrefix) {
        if (MigScript.Settings.local_settings[14]) {
            if (classPrefix) {
                (new MigScript.CustomObjects.AlerterClass(classPrefix)).alert(caption, msg);
            }
            else {
                (new MigScript.CustomObjects.AlerterClass()).alert(caption, msg);
            }
        }
    },
    helloMsg : "<center><h1>Здравствуйте!</b></h1></center><br>" +
               "<center>Версия <b>0.14.10</b></center><br><br>" +
               "<br> " +
               "<br> Приветствую вас, пользователи скрипта, и поздравляю с днём защитника Отечества!" +
               "<br>В версии 0.14 вы найдете:" +
        // "<br><br>Изменения:" +
               "<ul> " +
               "<li> Избранные группы можно вывести в плавающее окошко " +
               "<li> Избранных друзей можно вывести в плавающее окошко" +
               "<li> Подправлены некоторые стили" +
               "<li> <b>Контейнеры теперь растягиваются!</b> " +
               "<li> Кнопка \"Отправить сообщение через VkIM\" во всплывающем меню" +
               "<li> Кнопка, открывающая слова песни с lyricsplugin в новом окне" +
               "</ul>" +
               "<br> В версии 0.14.2:" +
               "<ul>" +
               "<li> Исправлено добавление друзей через всплывающее меню</li>" +
               "<li> Исправлено выпадение дополнительных пунктов меню вниз</li>" +
               "<li> Исправлено включение нескольких плавающих списков с избранными группами и людьми</li>" +
               "</ul>" +
               "<br> В версии 0.14.3:" +
               "<ul>" +
               "<li> Добавлено выпадающее подменю \"Стена\"</li>" +
               "<li> Ссылка на редактирование профиля перенесена в подменю</li>" +
               "<li> Исправлена кнопку \"Написать сообщение через vkIM\"</li>" +
               "</ul>" +
               "<br> В версии 0.14.4:" +
               "<ul>" +
               "<li> quickfix: поправлена проблема с вылетом скрипта 23.02.10</li>" +
               "<li> Новый стиль для расстягиваемых контейнеров <b>(возможны несколько столбцов при растягивании)</b></li>" +
               "</ul>" +
               "<br> В версии 0.14.10:" +
               "<ul>" +
               "<li> Поправлены стили</li>" +
               "<li> <b>Переделан движок оповещений</b> (см. <a href='http://vkontakte.ru/pages.php?id=10553319#4.14'>F.A.Q вопрос 4.14</a></b>)</li>" +
               "<li> <b>Ссылка на новое сообщение в оповещении</b></li>" +
               "<li> <b>Настройка анимации </b></li>" +
               "<li> Новый стиль в контейнерах</li>" +
               "</ul>" +
               "<br><br> Новая версия = новые баги. Жду ваших замечаний и пожеланий!" +
               "<br>" +
               "<br><br><hr><b>Hint:</b> В нашей группе появился <a href='http://vkontakte.ru/pages.php?id=10553319'>F.A.Q</a>!" +
               " Читайте!",
    registerGlobal : function() {
        unsafeWindow.MigScript = MigScript;
    },
    init: function() {
        MigScript.HOST = MigScript.Util.checkLocation("vk.com") ? "http://vk.com" : "http://vkontakte.ru";
        MigScript.myUid = MigScript.myUid ? MigScript.myUid : MigScript.Util.getMyUid();
        MigScript.log(MigScript.myUid);
        //Извещение
        MigScript.UI.showHelloMsg();
        MigScript.purge = MigScript.Util.deserialize("purge", false);
        MigScript.log("purge: " + MigScript.purge);
        if (MigScript.purge) {
            MigScript.Settings.purgeSettings();
        }
        if (! MigScript.Util.checkLocation("vk.hamlab.net")) {


            // Переделываем меню

            MigScript.Settings.init();
            MigScript.log("Settings init");
            MigScript.UI.MainMenu.resetMenu();

            MigScript.Watcher.init();
            MigScript.log("Watcher init");
            MigScript.Ajax.init();
            MigScript.log("Ajax init");

            if (!MigScript.opera) {
                MigScript.Update.init();
                MigScript.log("Update init");
            }
            MigScript.Styler.init();
            MigScript.log("Styler init");
            MigScript.Friends.init();
            MigScript.log("Friends init");
            MigScript.ExFriends.init();
            MigScript.log("exFriends init");
            MigScript.Menu.init();
            MigScript.log("Menu init");
            MigScript.Sound.init();
            MigScript.log("Sound init");

            MigScript.CustomObjects.checkAlerts();
            MigScript.UI.createUI();
            MigScript.log("UI created");
            MigScript.OnlineFriends.init();
            MigScript.log("OF init");
            MigScript.WhoFaved.init();
            MigScript.log("Who faved init");
            MigScript.FavContainer.init();
            MigScript.log("Containers init");
        } else {
            MigScript.Styler.prepareUI();
        }

        //        MigScript.Invisibility.setInvisible();
    }
};

MigScript.Settings = {
    loadSettings : function() {

        return [
            {
                n:2,
                id:"version",
                text:"Версия скрипта (кликни, чтобы обновить ->)",
                type:"alink",
                value:MigScript.Settings.local_settings[0],
                title: "Проверить наличие новой версии",
                action: MigScript.Update.forceUpd,
                condition: MigScript.Update.updReady,
                defaultValue: "0.0.0"
            },
            {
                n:19,
                id:"config_msg_add",
                text:"Добавить всплывающее меню каждому контакту",
                type:"checkbox",
                value:MigScript.Settings.local_settings[1]
            },
            {
                n:11,
                id:"config_fr_watch",
                text:"Включить модуль \"Бывшие друзья\"",
                type:"checkbox",
                value:MigScript.Settings.local_settings[2]
            },
            {
                n:71,
                id:"config_fr_timer",
                text:"Проверять список бывших друзей каждые Х минут",
                type:"input",
                value:MigScript.Settings.local_settings[3]
            },
            {
                n:15,
                id:"config_refresh_timer",
                text:"Задержка выпадения меню, мс",
                type:"input",
                value:MigScript.Settings.local_settings[4]
            },
            {
                n:31,
                id:"config_newmsg_bgcolor",
                text:"Цвет фона нового сообщения",
                type:"input",
                value:MigScript.Settings.local_settings[5]
            },
            {
                n:32,
                id:"config_newmsg_color",
                text:"Цвет текста нового сообщения",
                type:"input",
                value:MigScript.Settings.local_settings[6]
            },
            {
                n:33,
                id:"config_use_userstyle",
                text:"Использовать свой стиль",
                type:"checkbox",
                value:MigScript.Settings.local_settings[7]
            },
            {
                n:35,
                id:"config_userstyle",
                text:"Ваш стиль",
                type:"area",
                value:MigScript.Settings.local_settings[8]
            },
            {
                n:3 ,
                id:"config_upd_time",
                text:"Проверять обновление скрипта каждые Х часов",
                type:"input",
                value:MigScript.Settings.local_settings[9]
            },
            {
                n:21,
                id:"config_gsearch_vdownlinks",
                text:"Создавать ссылки на скачивание видео при поиске (кушает трафик)",
                type:"checkbox",
                value:MigScript.Settings.local_settings[10]
            },
            {
                n:34,
                id:"config_css_select",
                text:"Выбранный скин (нажми, чтобы изменить)",
                type:"alink",
                value:MigScript.Settings.local_settings[11],
                title: "Выбрать другой скин",
                defaultValue: "Стандартный",
                action: MigScript.Styler.showSkinSelector,
                condition: function() {
                    return true;
                }
            },
            {
                n:12,
                id:"config_onl_check",
                text:"Включить модуль \"Список друзей онлайн\"",
                type:"checkbox",
                value:MigScript.Settings.local_settings[12]
            },
            {
                n:72,
                id:"config_onl_period",
                text:"Обновлять онлайн-список каждые Х секунд",
                type:"input",
                value:MigScript.Settings.local_settings[13]
            },
            {
                n:41,
                id:"config_alert_show",
                text:"Включить всплывающие оповещения",
                type:"checkbox",
                value:MigScript.Settings.local_settings[14]
            },
            {
                n:62,
                id:"config_sound_play",
                text:"Проигрывать звуки",
                type:"checkbox",
                value:MigScript.Settings.local_settings[15]
            },
            {
                n:32,
                id:"config_alert_rem",
                text:"Оповещения исчезают через Х секунд",
                type:"input",
                value:MigScript.Settings.local_settings[16]
            },
            {
                n:44,
                id:"config_alert_show_msg",
                text:"Оповещать о новых сообщениях",
                type:"checkbox",
                value:MigScript.Settings.local_settings[17]
            },
            {
                n:43,
                id:"config_alert_show_online",
                text:"Оповещать о выходе друзей в сеть",
                type:"checkbox",
                value:MigScript.Settings.local_settings[18]
            },
            {
                n:13,
                id:"config_menu_reset",
                text:"Включить новый вид главного меню (выпадающие ссылки)",
                type:"checkbox",
                value:MigScript.Settings.local_settings[19]
            },
            {
                n:73,
                id:"config_watcher_period",
                text:"Проверять обновления сообщений, отметок и т.д. каждые Х секунд",
                type:"input",
                value:MigScript.Settings.local_settings[20]
            },
            {
                n:16,
                id:"config_mainmenu_btn",
                text:"Плавающее главное меню (можно отцепить)",
                type:"checkbox",
                value:MigScript.Settings.local_settings[21]
            },
            {
                n:35,
                id:"config_mainmenu_spanpage",
                text:"При отцепливании главного меню страница расширяется",
                type:"checkbox",
                value:MigScript.Settings.local_settings[22]
            },
            {
                n:45,
                id:"config_alert_show_fr",
                text:"Оповещать о заявках на дружбу",
                type:"checkbox",
                value:MigScript.Settings.local_settings[23]
            },
            {
                n:46,
                id:"config_alert_show_photos",
                text:"Оповещать об отметках на фото",
                type:"checkbox",
                value:MigScript.Settings.local_settings[24]
            },
            {
                n:47,
                id:"config_alert_show_videos",
                text:"Оповещать об отметках на видео",
                type:"checkbox",
                value:MigScript.Settings.local_settings[25]
            },
            {
                n:48,
                id:"config_alert_show_notes",
                text:"Оповещать о новых комментариях к заметкам",
                type:"checkbox",
                value:MigScript.Settings.local_settings[26]
            },
            {
                n:49,
                id:"config_alert_show_groups",
                text:"Оповещать о приглашениях в группы",
                type:"checkbox",
                value:MigScript.Settings.local_settings[27]
            },
            {
                n:50,
                id:"config_alert_show_events",
                text:"Оповещать о приглашениях на мероприятия",
                type:"checkbox",
                value:MigScript.Settings.local_settings[28]
            },
            {
                n:63,
                id:"config_sound_online",
                text:"Звук при выходе друзей онлайн",
                type:"checkbox",
                value:MigScript.Settings.local_settings[29]
            },
            {
                n:64,
                id:"config_sound_message",
                text:"Звук при получении нового сообщения",
                type:"checkbox",
                value:MigScript.Settings.local_settings[30]
            },
            {
                n:65,
                id:"config_sound_new items",
                text:"Звук при обновлении фото, видео, заметок и т.д.",
                type:"checkbox",
                value:MigScript.Settings.local_settings[31]
            },
            {
                n:14,
                id:"config_mainmenu_cascadeRight",
                text:"Главное меню раскрывается вправо",
                type:"checkbox",
                value:MigScript.Settings.local_settings[32]
            },
            {
                n:22,
                id:"config_whofaved",
                text:"Всключить модуль \"Кто добавил в закладки\"",
                type:"checkbox",
                value:MigScript.Settings.local_settings[33]
            },
            {
                n:18,
                id:"config_vdownlinks",
                text:"Добавлять ссылки на скачивание видео",
                type:"checkbox",
                value:MigScript.Settings.local_settings[34]
            },
            {
                n:22,
                id:"config_adownlinks",
                text:"Добавлять ссылки на скачивание аудио",
                type:"checkbox",
                value:MigScript.Settings.local_settings[35]
            },
            {
                n:23,
                id:"config_audio_dublicates",
                text:"Удалять дубликаты при поиске аудио",
                type:"checkbox",
                value:MigScript.Settings.local_settings[36]
            },
            {
                n:16,
                id:"config_stripmenu",
                text:"Убирать префиксы в меню",
                type:"checkbox",
                value:MigScript.Settings.local_settings[37]
            },
            {
                n:17,
                id:"config_stripmenu_mask",
                text:"Удалять следующие префиксы",
                type:"input",
                value:MigScript.Settings.local_settings[38]
            },
            {
                n:24,
                id:"config_animation",
                text:"Анимация и эффекты",
                type:"checkbox",
                value:MigScript.Settings.local_settings[39]
            },


            //Должно быть в самом низу
            {
                n:61,
                id:"config_sound_infolabel",
                text:"Для проигрывания звуков нужен отдельный файл Mig[vk]Sound",
                type:"alink",
                value:"Установить звуки",
                title: "Установить скрипт Mig[vk]Sound",
                defaultValue: "Установить звуки",
                action: function() {
                    window.location = "http://userscripts.org/scripts/source/64840.user.js";
                },
                condition: function() {
                    return true;
                }
            },


            {
                n:1,
                label:"Автообновление",
                type: "section"
            },
            {
                n:10,
                label:"Модули",
                type: "section"
            },
            {
                n:30,
                label: "Стили и скины",
                type: "section"
            },
            {
                n:40,
                label: "Оповещения",
                type: "section"
            },
            {
                n:60,
                label: "Звуки",
                type: "section"
            },
            {
                n:70,
                label: "Управление запросами",
                type: "section"
            },


        ];
    },
    getDefaultSettings : function () {//1                                                                                //10                                                          //20                                                //30                           //35
        return [MigScript.SCRIPT_VERSION, true, true, 30, 300,"#eeee00", "navy", true, MigScript.Styler.getDefaultStyle() ,1, false,"Стандартный", true, 30, true, true, 5, true, true, true, 5,true, true, true,true,true,true,true,true, true, true, true, true, true, true, true, true, true, "Мои|Мое", true];
    },
    local_settings : null,
    default_settings : null,
    settings : null,
    getSortedSettings : function () {
        var ss = new Array();
        for (var i = 0; i < MigScript.Settings.settings.length; i++) {
            ss.push(MigScript.Settings.settings[i]);
            // MigScript.log(ss[i]);
        }
        return ss.sort(MigScript.Util.sNum);
    },
    saveSettings:function () {

        for (var i = 1; i < MigScript.Settings.settings.length; i++) {
            var value = null;
            try {
                value = eval(MigScript.DomUtil.ge(MigScript.Settings.settings[i].id).getAttribute("value"));
            } catch(e) {
                try {
                    value = MigScript.DomUtil.ge(MigScript.Settings.settings[i].id).getAttribute("value");
                } catch(e) {
                }
            }
            try {

                if (value == null) {
                    if (MigScript.DomUtil.ge(MigScript.Settings.settings[i].id).value != null) {
                        value = MigScript.DomUtil.ge(MigScript.Settings.settings[i].id).value;
                    }
                }
                MigScript.Settings.local_settings[i] = value;
            } catch(e) {

            }
        }
        var ls = MigScript.Settings.local_settings;
        MigScript.Util.serialize("local_settings", ls);
        window.location.reload();
    },
    resetSettings:function () {
        MigScript.Util.serialize("local_settings", MigScript.Settings.getDefaultSettings());
        MigScript.Util.serialize("updRejected", false);
        MigScript.Util.serialize("newVer", MigScript.SCRIPT_VERSION);
        MigScript.Util.serialize("updTime", 0);
        window.location.reload();
    },
    purgeSettings: function() {
        if (confirm("Все настройки скрипта будут удалены ПОЛНОСТЬЮ! Вы точно уверены, что этого хотите ??")) {
            MigScript.Util.serialize("local_settings", null);
            MigScript.Util.serialize("favFriends", null);
            MigScript.Util.serialize("exFriends", null);
            MigScript.Util.serialize("lastList", null);
            MigScript.Util.serialize("last_checked", null);
            MigScript.Util.serialize("olFloat", null);
            MigScript.Util.serialize("olFloat_x", null);
            MigScript.Util.serialize("olFloat_y", null);
            MigScript.Util.serialize("olFloat_fix", null);
            MigScript.Util.serialize("olFloat_roll", null);
            MigScript.Util.serialize("onlFriends", null);
            MigScript.Util.serialize("onlUpdTime", null);
            MigScript.Util.serialize("updTime", null);
            MigScript.Util.serialize("newVer", null);
            MigScript.Util.serialize("updRejected", null);
            MigScript.Util.serialize("hello", null);
            MigScript.Util.serialize("alerts", null);

            MigScript.Util.serialize("purge", false);
            window.location.reload();
        }
    },
    init : function() {
        MigScript.myUid = MigScript.Util.getMyUid();
        MigScript.Settings.local_settings = MigScript.Util.deserialize("local_settings");
        //MigScript.log(MigScript.Settings.local_settings );
        MigScript.Settings.default_settings = MigScript.Settings.getDefaultSettings();
        MigScript.Settings.local_settings = MigScript.Settings.local_settings ? MigScript.Settings.local_settings : new Array();
        // Добавляем в сохраненные настройки то, что отсутствовало в предыдущей версии...
        if (MigScript.Settings.local_settings.length < MigScript.Settings.default_settings.length) {
            for (var i = MigScript.Settings.local_settings.length; i < MigScript.Settings.default_settings.length; i++) {
                MigScript.Settings.local_settings.push(MigScript.Settings.default_settings[i]);
            }
        }

        // Устанавливаем текущую версию
        if (MigScript.Settings.local_settings[0] != MigScript.SCRIPT_VERSION) {
            MigScript.Settings.local_settings[0] = MigScript.SCRIPT_VERSION;
        }
        MigScript.Settings.settings = MigScript.Settings.loadSettings();
        MigScript.Settings.tsettings = MigScript.Settings.getSortedSettings();
    }
};

MigScript.Ajax = {
    AjaxClass : function (onDone, onFail, eval_res) {
        var _t = this;
        this.onDone = onDone;
        this.onFail = onFail;
        var tran = null;
        var calls = 0;
        try {
            tran = new XMLHttpRequest();
        }
        catch(e) {
            tran = null;
        }
        try {
            if (!tran) tran = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e) {
            tran = null;
        }
        try {
            if (!tran) tran = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e) {
            tran = null;
        }

        var parseRes = function() {
            if (!tran || !tran.responseText)return;
            var res = tran.responseText.replace(/^[\s\n]+/g, '');

            if (res.substr(0, 10) == "<noscript>")
            {
                try {
                    var arr = res.substr(10).split("</noscript>");
                    eval(arr[0]);
                    tran.responseText = arr[1];
                } catch(e) {
                }
            } else {
            }
        };
        this.get = function(u, q, f) {
            f = f || false;
            if (typeof(q) != 'string')q = MigScript.Ajax.ajx2q(q);
            u = u + (q ? ('?' + q) : '');
            tran.open('GET', u, !f);
            if (calls) {
                tran.onreadystatechange = function() {
                    stateDisp();
                };
            }
            tran.setRequestHeader("X-Requested-With", "XMLHttpRequest");
            tran.send('');
            calls++;
        };
        this.post = function(u, d, f) {
            f = f || false;
            if (typeof(d) != 'string')d = MigScript.Ajax.ajx2q(d);
            tran.open('POST', u, !f);
            if (calls) {
                tran.onreadystatechange = function() {
                    stateDisp();
                };
            }
            tran.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            tran.setRequestHeader("X-Requested-With", "XMLHttpRequest");
            tran.send(d);
            calls++;
        };
        var stateDisp = function() {
            if (tran.readyState == 4) {
                if (tran.status >= 200 && tran.status < 300) {
                    if (eval_res) parseRes();
                    if (_t.onDone) _t.onDone(_t, tran.responseText);
                } else {
                    if (_t.onFail) _t.onFail(_t, tran.responseText);
                }
            }
        };
        tran.onreadystatechange = stateDisp;
    }
    ,
    ajx2q : function (qa) {
        var query = [];

        for (var key in qa) {
            if (qa[key] === undefined || qa[key] === null || typeof(qa[key]) == 'function')continue;
            query.push(encodeURIComponent(key) + '=' + encodeURIComponent(qa[key]));
        }
        return query.join('&');
    },
    ajax : null,
    init : function () {
        MigScript.Ajax.ajax = new MigScript.Ajax.AjaxClass(function() {
        }, function() {
            MigScript.log("ajax error");
        });
    }

};

MigScript.Update = {
    UpdaterClass : function(updTime) {
        var _t = this;
        var S_ID = 54446;
        var url = 'http://userscripts.org/scripts/review/' + S_ID + '.txt';
        var randSeed = Math.floor(1 + (9999) * Math.random());

        this.init = function()
        {
            if (MigScript.Util.checkPeriod("updTime", updTime))
            {
                MigScript.log("update check");
                this.check();
            }
        };

        this.check = function()
        {
            // console.log(randSeed);
            randSeed = Math.floor(1 + (9999) * Math.random());
            MigScript.log("update url: " + url + "?seed=" + randSeed);
            GM_xmlhttpRequest({method:"GET",url:url + "?seed=" + randSeed,onreadystatechange:this.update});
            MigScript.log("ask for update");
        };

        this.update = function(o)
        {
            if (o.readyState == 4)
            {
                var checkver = o.responseText.substr(0, 300);
                //console.log(checkver);
                checkver = checkver.split('@version')[1];
                checkver = checkver.match(/\d+\.\d+\.\d+/);
                var vnum = checkver.toString();
                checkver = vnum.split('.');

                var thisver = MigScript.SCRIPT_VERSION.split('.');
                var flag = false;
                checkver = parseInt(checkver[0] * 10000) + parseInt(checkver[1] * 100) + parseInt(checkver[2]);
                thisver = parseInt(thisver[0] * 10000) + parseInt(thisver[1] * 100) + parseInt(thisver[2]);
                MigScript.log("update processed");
                MigScript.log("v:" + thisver + " u:" + checkver);

                if (checkver - thisver > 0)
                {
                    flag = true;
                    MigScript.Util.serialize("newVer", vnum);
                }
                var isRej = MigScript.Util.deserialize("updRejected", false);
                if (flag && !isRej)
                {
                    // MigScript.log("prompt");
                    if (confirm("Новое обновление Mig[vk]Script v " + vnum + " есть в наличии. Обновить скрипт??"))
                    {
                        _t.install();
                    } else {
                        MigScript.Util.serialize("updRejected", true);
                    }
                }

            }
        };

        this.install = function() {
            MigScript.Util.serialize("updRejected", false);
            MigScript.Util.serialize("hello", false);
            window.location = 'http://userscripts.org/scripts/source/' + S_ID + '.user.js';

        };

        this.init();
    },
    updater : null,
    forceUpd : function () {
        MigScript.Util.serialize("updRejected", false);
        MigScript.Update.updater.check();
    },

    forceInst : function () {
        var isRej = MigScript.Util.deserialize("updRejected", false);
        if (!isRej) {
            MigScript.Update.updater.check();
        } else {
            MigScript.Update.updater.install();
        }

    },
    updReady: function () {
        var v = MigScript.Util.deserialize("newVer", 0);
        var rej = MigScript.Util.deserialize("updRejected", false);
        if (rej) {
            var im = MigScript.DomUtil.dc("img");
            im.src = MigScript.UI.Images.warningImg();
            im.id = "warn_upd";
            im.title = "Имеется новая v " + v + " версия скрипта!";
            im.width = "20";
            im.style.marginRight = "10px";
            im.style.marginBottom = "-5px";
            im.style.cursor = "pointer";
            im.addEventListener("click", function() {
                MigScript.Update.forceInst();
            }, true);
            MigScript.DomUtil.ge("version").parentNode.insertBefore(im, MigScript.DomUtil.ge("version"));
        }
    },
    init : function () {
        MigScript.Update.updater = new MigScript.Update.UpdaterClass(MigScript.Settings.local_settings[9] * 1000 * 60);
    }
};

MigScript.CustomObjects = {
    floaters : new Array(),
    serializableAlerters : new Array(),
    alerters : new Array(),
    CheckboxClass : function (_id, _value) {
        this.body = MigScript.DomUtil.dc("img");
        this.body.id = _id;
        this.body.style.cursor = "pointer";
        this.body.value = eval(_value);
        var _v = uneval(_value);
        this.body.setAttribute("value", _v);
        if (!this.body.value) {
            this.body.src = MigScript.UI.Images.uncheckedImg();
        } else if (this.body.value) {
            this.body.src = MigScript.UI.Images.checkedImg();
        }
        this.body.addEventListener("click", function() {
            toggleChk(this.id);
        }, true);
        var toggleChk = function(id) {
            var img = MigScript.DomUtil.ge(id);
            var value = eval(img.getAttribute("value"));
            value = !value;

            img.setAttribute("value", uneval(value));
            if (!value) {
                img.src = MigScript.UI.Images.uncheckedImg();
            } else if (value) {
                img.src = MigScript.UI.Images.checkedImg();
            }
        };
    },
    Dragable : function(element, handleElement, startCallback, stopCallback, dragCallback, bound) {
        if (typeof(element) == "string")
            element = document.getElementById(element);
        if (element == null) {
            return;
        }

        bound = bound || {};
        if (bound.canMove == null) {
            bound.canMove = true;
        }

        if (typeof(handleElement) == "string")
            handleElement = document.getElementById(handleElement);
        if (handleElement == null)
            handleElement = element;

        this.ox = 0;
        this.oy = 0;

        this.isDrag = false;
        var _t = this;


        this.startDrag = function(e) {
            if (e.stopPropagation)
                e.stopPropagation();
            if (e.preventDefault)
                e.preventDefault();
            e.cancelBubble = true;
            e.cancel = true;
            e.returnValue = false;

            _t.isDrag = true;
            _t.ox = e.pageX;
            _t.oy = e.pageY;
            //document.body.setAttribute("style", "-moz-user-select:none;");
            if (startCallback) {
                startCallback();
            }
            // MigScript.log("fl " + this.id + " dragstart");
        };

        this.stopDrag = function(e) {
            if (_t.isDrag) {
                _t.isDrag = false;
                if (stopCallback) {
                    stopCallback();
                }
            }
        };

        this.drag = function(e) {
            if (_t.isDrag) {
                if (e.stopPropagation)
                    e.stopPropagation();
                if (e.preventDefault)
                    e.preventDefault();
                e.cancelBubble = true;
                e.cancel = true;
                e.returnValue = false;

                var px = e.pageX - _t.ox;
                var py = e.pageY - _t.oy;
                _t.ox = e.pageX;
                _t.oy = e.pageY;
                if (bound.left && _t.ox < bound.left) {
                    _t.ox = bound.left;
                }
                if (bound.right && _t.ox > bound.right) {
                    _t.ox = bound.right;
                }
                if (bound.top && _t.oy < bound.top) {
                    _t.oy = bound.top;
                }
                if (bound.bottom && _t.oy > bound.bottom) {
                    _t.oy = bound.bottom;
                }
                if (bound.canMove) {
                    element.style.left = element.offsetLeft + px + "px";
                    element.style.top = element.offsetTop + py + "px";
                }

                if (dragCallback) {
                    dragCallback(px, py);
                }

                // MigScript.log("fl " + this.id + " x:" + this.x + " y:" + this.y);
            }
        };

        handleElement.addEventListener("mousedown", this.startDrag, false);
        handleElement.addEventListener("mouseup", this.stopDrag, false);
        document.addEventListener("mouseup", this.stopDrag, false);
        document.addEventListener("mousemove", this.drag, false);

    },
    Resizable : function(element, config) {
        if (typeof(element) == "string")
            element = MigScript.DomUtil.ge(element);
        if (element == null) {
            return;
        }
        config = config || {};

        var borderWidth = config.borderWidth || 4;
        var _width = config.width || config.minWidth || 10 * borderWidth;
        var _height = config.height || config.minHeight || 10 * borderWidth;


        var _t = this;
        if (config.bodyNode) {
            if (typeof(config.bodyNode) == "string")
                config.bodyNode = document.getElementById(config.bodyNode);
            this.body = config.bodyNode;
        } else {
            this.body = MigScript.DomUtil.dc("div");
            this.body.className = "resBody";
            element.parentNode.appendChild(this.body);
        }


        var nwHandle = MigScript.DomUtil.dc("div");
        nwHandle.className = "nwHandle";
        var moveXDirection = function(ox) {
            if (_width + ox > config.minWidth) {
                _width += ox;
            } else if (_width != config.minWidth) {
                ox = config.minWidth - (_width);
                _width = config.minWidth;
            } else {
                ox = 0;
            }
            return ox;
        };

        var moveYDirection = function (oy) {
            if (_height + oy > config.minHeight) {
                _height += oy;
            } else if (_height != config.minHeight) {
                oy = config.minHeight - (_height);
                _height = config.minHeight;
            } else {
                oy = 0;
            }
            return oy;
        };

        var nwResize = function(ox, oy) {
            ox = moveXDirection(-ox);
            oy = moveYDirection(-oy);
            _t.updatePosition(-ox, -oy);
        };

        new MigScript.CustomObjects.Dragable(nwHandle, null, null, null, nwResize, {canMove: false});

        var nHandle = MigScript.DomUtil.dc("div");
        nHandle.className = "nHandle handler";
        var nResize = function(ox, oy) {
            ox = 0;
            oy = moveYDirection(-oy);
            _t.updatePosition(ox, -oy);
        };
        new MigScript.CustomObjects.Dragable(nHandle, null, null, null, nResize, {canMove: false});

        var neHandle = MigScript.DomUtil.dc("div");
        neHandle.className = "neHandle handler";
        var neResize = function(ox, oy) {
            ox = moveXDirection(ox);
            oy = moveYDirection(-oy);
            _t.updatePosition(0, -oy);
        };
        new MigScript.CustomObjects.Dragable(neHandle, null, null, null, neResize, {canMove: false});


        var eHandle = MigScript.DomUtil.dc("div");
        eHandle.className = "eHandle handler";
        var eResize = function(ox, oy) {
            ox = moveXDirection(ox);
            oy = 0;
            _t.updatePosition(0, oy);
        };
        new MigScript.CustomObjects.Dragable(eHandle, null, null, null, eResize, {canMove: false});

        var seHandle = MigScript.DomUtil.dc("div");
        seHandle.className = "seHandle handler";
        var seResize = function(ox, oy) {
            ox = moveXDirection(ox);
            oy = moveYDirection(oy);
            _t.updatePosition(0, 0);
        };
        new MigScript.CustomObjects.Dragable(seHandle, null, null, null, seResize, {canMove: false});

        var sHandle = MigScript.DomUtil.dc("div");
        sHandle.className = "sHandle handler";
        var sResize = function(ox, oy) {
            oy = moveYDirection(oy);
            _t.updatePosition(0, 0);
        };
        new MigScript.CustomObjects.Dragable(sHandle, null, null, null, sResize, {canMove: false});

        var swHandle = MigScript.DomUtil.dc("div");
        swHandle.className = "swHandle handler";
        var swResize = function(ox, oy) {
            ox = moveXDirection(-ox);
            oy = moveYDirection(oy);
            _t.updatePosition(-ox, 0);
        };
        new MigScript.CustomObjects.Dragable(swHandle, null, null, null, swResize, {canMove: false});

        var wHandle = MigScript.DomUtil.dc("div");
        wHandle.className = "wHandle handler";
        var wResize = function(ox, oy) {
            ox = moveXDirection(-ox);
            oy = 0;
            _t.updatePosition(-ox, oy);
        };
        new MigScript.CustomObjects.Dragable(wHandle, null, null, null, wResize, {canMove: false});

        this.container = MigScript.DomUtil.dc("div");
        this.container.className = "resContainer";
        this.container.style.marginTop = borderWidth + "px";
        this.container.style.marginLeft = borderWidth + "px";


        if (! config.handles) {
            config.handles = "all";
        }

        if (/all/.test(config.handles) || /nw/.test(config.handles)) {
            this.body.appendChild(nwHandle);
        }
        if (/all/.test(config.handles) || /n/.test(config.handles)) {
            this.body.appendChild(nHandle);
        }
        if (/all/.test(config.handles) || /ne/.test(config.handles)) {
            this.body.appendChild(neHandle);
        }
        if (/all/.test(config.handles) || /w/.test(config.handles)) {
            this.body.appendChild(wHandle);
        }
        this.body.appendChild(this.container);
        if (/all/.test(config.handles) || /e/.test(config.handles)) {
            this.body.appendChild(eHandle);
        }
        if (/all/.test(config.handles) || /sw/.test(config.handles)) {
            this.body.appendChild(swHandle);
        }
        if (/all/.test(config.handles) || /s/.test(config.handles)) {
            this.body.appendChild(sHandle);
        }
        if (/all/.test(config.handles) || /se/.test(config.handles)) {
            this.body.appendChild(seHandle);
        }

        this.container.appendChild(element);

        this.updatePosition = function(ox, oy) {
            this.body.style.width = _width + 2 * borderWidth + "px";
            this.body.style.height = _height + 2 * borderWidth + "px";
            if (ox != 0) {
                _t.body.style.left = _t.body.offsetLeft + ox + "px";
            }
            if (oy != 0) {
                _t.body.style.top = _t.body.offsetTop + oy + "px";
            }

            nwHandle.style.width = borderWidth + "px";
            nwHandle.style.height = borderWidth + "px";

            nHandle.style.width = _width + "px";
            nHandle.style.height = borderWidth + "px";
            nHandle.style.left = borderWidth + "px";

            neHandle.style.width = borderWidth + "px";
            neHandle.style.height = borderWidth + "px";
            neHandle.style.left = borderWidth + _width + "px";

            eHandle.style.width = borderWidth + "px";
            eHandle.style.height = _height + "px";
            eHandle.style.left = borderWidth + _width + "px";
            eHandle.style.top = borderWidth + "px";

            sHandle.style.width = _width + "px";
            sHandle.style.height = borderWidth + "px";
            sHandle.style.left = borderWidth + "px";
            sHandle.style.top = borderWidth + _height + "px";

            seHandle.style.width = borderWidth + "px";
            seHandle.style.height = borderWidth + "px";
            seHandle.style.left = borderWidth + _width + "px";
            seHandle.style.top = borderWidth + _height + "px";

            swHandle.style.width = borderWidth + "px";
            swHandle.style.height = borderWidth + "px";
            swHandle.style.top = borderWidth + _height + "px";

            wHandle.style.width = borderWidth + "px";
            wHandle.style.height = _height + "px";
            wHandle.style.top = borderWidth + "px";

            if (config.onEndResize) {
                config.onEndResize(_width, _height);
            }
        };

        this.setHeight = function (height) {
            _height = height;
            this.updatePosition();
        };

        this.updatePosition();
    },
    FloaterClass : function(_x, _y, name, label, config) {
        this.name = name;
        this.label = label;
        var _t = this;
        this.rolled = MigScript.Util.deserialize(this.name + "_roll", false);

        var x = _x;
        var y = _y;
        config = config || {};

        this.fixed = MigScript.Util.deserialize(this.name + "_fix", false);
        this.isDrag = false;
        this.onClose = null;
        var _id = MigScript.CustomObjects.floaters.length;
        MigScript.CustomObjects.floaters.push(this);
        this.id = _id;
        //MigScript.log("new floater: " + _id);
        //MigScript.log(" floaters.length = " + MigScript.CustomObjects.floaters.length);
        var onStartDrag = function() {
            MigScript.DomUtil.ge("fl_" + _t.id + "_head").style.cursor = "move";
        };

        var onStopDrag = function() {
            MigScript.DomUtil.ge("fl_" + _t.id + "_head").style.cursor = "default";
            //document.body.setAttribute("style", "-moz-user-select:text;");
            var el = MigScript.DomUtil.ge(_t.name);
            x = el.offsetLeft;
            y = el.offsetTop;
            MigScript.Util.serialize(_t.name + "_x", x);
            MigScript.Util.serialize(_t.name + "_y", y);

            //  MigScript.log("fl " + this.id + " dragstop");
        };

        this.updateSize = function (width, height) {
            _t.body.style.width = width + "px";
            _t.body.style.height = height - _t.head.offsetHeight - _t.txt.offsetHeight + "px";
            _t.cont.style.width = width + "px";
            _t.cont.style.height = height + "px";
            MigScript.Util.serialize(_t.name + "_W", width);
            MigScript.Util.serialize(_t.name + "_H", height);
        };

        var resHandler = null;

        this.createUI = function() {

            this.wrapCont = MigScript.DomUtil.dc("div");
            this.wrapCont.className = "floater_cont";
            this.wrapCont.id = this.name;
            this.wrapCont.style.left = x + "px";
            this.wrapCont.style.top = y + "px";

            this.cont = MigScript.DomUtil.dc("div");
            this.cont.className = "floater_cont_inner";
            this.cont.style.width = config.minWidth + "px";
            this.cont.style.height = config.minHeight + "px";
            //this.cont.style.width = this.width + "px";

            document.body.appendChild(this.wrapCont);
            this.wrapCont.appendChild(this.cont);


            this.head = MigScript.DomUtil.dc("div");
            this.head.id = "fl_" + this.id + "_head";
            this.head.className = "floater_head";
            this.cont.appendChild(this.head);

            this.txt = MigScript.DomUtil.dc("div");
            this.txt.id = "fl_" + this.id + "_txt";
            this.txt.className = "floater_txt";
            this.cont.appendChild(this.txt);

            if (config.width < config.minWidth) {
                config.width = null;
            }

            if (config.height < config.minHeight) {
                config.height = null;
            }

            config.minWidth = config.minWidth || 125;
            config.minHeight = config.minHeight || this.head.offsetHeight + this.txt.offsetHeight;


            this.body = MigScript.DomUtil.dc("div");
            this.body.id = "fl_" + this.id + "_body";
            this.body.className = "floater_body";
            this.body.style.overflow = "auto";
            this.body.style.height = config.minHeight - this.head.offsetHeight - this.txt.offsetHeight + "px";
            if (this.rolled) {
                this.body.style.display = "block";
            } else {
                this.body.style.display = "none";
            }
            //     this.body.style.height = "300px";
            this.cont.appendChild(this.body);

            var label = MigScript.DomUtil.dc("a");
            label.innerHTML = this.label;
            var blabel = MigScript.DomUtil.dc("b");
            this.head.appendChild(blabel);
            blabel.appendChild(label);
            blabel.style.setProperty("float", "left", "");
            blabel.style.marginLeft = "5px";
            blabel.style.marginTop = "3px";


            var fxBtn = MigScript.DomUtil.dc("a");
            fxBtn.id = "fl_" + this.id + "_fx_btn";
            fxBtn.title = "Фиксировать";
            if (!this.fixed) {
                fxBtn.innerHTML = "<b>[f]</b>";
                this.wrapCont.style.setProperty("position", "absolute", "important");
            } else {
                fxBtn.innerHTML = "<font style='color:#f00!important;'><b>[f]</b></font>";
                this.wrapCont.style.setProperty("position", "fixed", "important");
            }
            fxBtn.style.cursor = "pointer";
            fxBtn.style.fontSize = "8pt";
            fxBtn.style.marginRight = "5px";
            fxBtn.style.marginTop = "2px";
            fxBtn.style.setProperty("float", "right", "");
            fxBtn.addEventListener("click", function(e) {
                MigScript.CustomObjects.floaters[_id].dofix(e);
            }, true);
            this.head.appendChild(fxBtn);

            var closeBtn = MigScript.DomUtil.dc("a");
            closeBtn.id = "fl_" + this.id + "_cls_btn";
            closeBtn.innerHTML = "<b>_</b>";
            closeBtn.title = "Закрыть";
            closeBtn.style.cursor = "pointer";
            closeBtn.style.fontSize = "8pt";
            closeBtn.style.marginRight = "5px";
            closeBtn.style.marginTop = "2px";
            closeBtn.style.setProperty("float", "right", "");
            closeBtn.addEventListener("click", function() {
                MigScript.CustomObjects.floaters[_id].close();
            }, true);
            this.head.appendChild(closeBtn);

            var rollBtn = MigScript.DomUtil.dc("a");
            rollBtn.id = "fl_" + this.id + "_roll_btn";
            if (this.rolled) {
                rollBtn.innerHTML = "[-]";
            } else {
                rollBtn.innerHTML = "[+]";
            }
            rollBtn.title = "Развернуть";
            rollBtn.style.cursor = "pointer";
            rollBtn.style.fontSize = "8pt";
            rollBtn.style.marginRight = "5px";
            rollBtn.style.marginTop = "2px";
            rollBtn.style.setProperty("float", "right", "");
            rollBtn.addEventListener("click", function() {
                MigScript.CustomObjects.floaters[_id].roll();
            }, true);
            this.head.appendChild(rollBtn);

            new MigScript.CustomObjects.Dragable(this.wrapCont, this.head, onStartDrag, onStopDrag);
            resHandler = new MigScript.CustomObjects.Resizable(this.cont, {
                handles: "all",
                minWidth : config.minWidth,
                width : config.width,
                height : config.height,
                minHeight: config.minHeight,
                onEndResize: _t.updateSize,
                bodyNode: _t.wrapCont
            });
            //  MigScript.log("floater "+this.id + " UI created");
        };

        this.roll = function() {
            MigScript.UI.togglePlusBtn("fl_" + this.id + "_roll_btn");
            var height = this.head.offsetHeight + this.txt.offsetHeight;
            if (this.body.style.display == "none") {
                this.rolled = true;
                height = MigScript.Util.deserialize(this.name + "_oH", 0);
                resHandler.setHeight(height);
                this.body.style.setProperty("display", "block", "important");

            } else {
                this.rolled = false;
                MigScript.Util.serialize(this.name + "_oH", height + this.body.offsetHeight);
                this.body.style.setProperty("display", "none", "important");
                resHandler.setHeight(height);
            }
            MigScript.Util.serialize(this.name + "_roll", this.rolled);
            // MigScript.log("fl " + this.id + " is rolled");
        };


        this.fix = function(e) {
            x -= window.scrollX;
            y -= window.scrollY;
            this.wrapCont.style.left = x + "px";
            this.wrapCont.style.top = y + "px";
            this.wrapCont.style.setProperty("position", "fixed", "important");
            var btn = MigScript.DomUtil.ge("fl_" + this.id + "_fx_btn");
            var _id = this.id;
            btn.innerHTML = "<font style='color:#f00!important;'><b>[f]</b></font>";
            MigScript.Util.serialize(this.name + "_fix", true);
            MigScript.Util.serialize(_t.name + "_x", x);
            MigScript.Util.serialize(_t.name + "_y", y);
        };
        this.unfix = function() {
            this.wrapCont.style.setProperty("position", "absolute", "important");
            var btn = MigScript.DomUtil.ge("fl_" + this.id + "_fx_btn");
            var _id = this.id;
            x += window.scrollX;
            y += window.scrollY;
            this.wrapCont.style.left = x + "px";
            this.wrapCont.style.top = y + "px";
            btn.innerHTML = "<b>[f]</b>";
            MigScript.Util.serialize(this.name + "_fix", false);
            MigScript.Util.serialize(_t.name + "_x", x);
            MigScript.Util.serialize(_t.name + "_y", y);
        };

        this.dofix = function(e) {
            if (MigScript.DomUtil.ge("fl_" + this.id + "_fx_btn").innerHTML == "<b>[f]</b>") {
                this.fix(e);
            } else {
                this.unfix();
            }
        };

        this.wakeUp = function(_x, _y) {
            MigScript.log("wake up " + _x + "_" + _y);
            x = _x;
            y = _y;
            this.wrapCont.style.left = x;
            this.wrapCont.style.top = y;
            this.wrapCont.style.setProperty("display", "block", "important");
        };

        this.close = function() {
            this.wrapCont.style.setProperty("display", "none", "important");
            MigScript.Util.serialize(this.name + "_x", x);
            MigScript.Util.serialize(this.name + "_y", y);
            MigScript.Util.serialize(this.name + "_fix", this.fixed);
            MigScript.Util.serialize(this.name + "_roll", this.rolled);
            if (this.onClose) {
                this.onClose();
            }
        };

        this.createUI();
    },
    AlerterClass: function(prefix) {
        var _t = this;
        this.id = -1;
        this.body = null;
        this.capt = null;
        this.cont = null;
        this.prefix = null;
        this.caption = "";
        this.text = "";

        this.isActive = false;

        var render = function() {
            var x = MigScript.Util.deserialize(_t.prefix + "posX", document.documentElement.clientWidth - _t.cont.offsetWidth);
            var y = MigScript.Util.deserialize(_t.prefix + "posY", document.documentElement.clientHeight - _t.cont.offsetHeight);
            _t.cont.style.left = x + "px";
            _t.cont.style.top = y + "px";
        };
        var push = function() {
            MigScript.CustomObjects.alerters.push(_t);
            _t.id = MigScript.CustomObjects.alerters.length;
        };
        var showNext = function() {
            var next = MigScript.CustomObjects.alerters[_t.id];
            if (next) {
                next.show();
            } else {
                MigScript.CustomObjects.alerters = new Array();
            }
        };

        var createUI = function() {

            _t.cont = MigScript.DomUtil.dc("div");
            _t.cont.className = _t.prefix + "alert_cont";
            _t.cont.id = "al_" + _t.id + "_cont";

            document.body.appendChild(_t.cont);

            var head = MigScript.DomUtil.dc("div");
            head.className = _t.prefix + "alert_head";
            head.id = "al_" + _t.id + "_head";
            new MigScript.CustomObjects.Dragable(_t.cont, null, null, onDragStop);
            _t.cont.addEventListener("dblclick", function(e) {
                e.stopPropagation();
                _t.close();
            }, false);


            var cl_link = MigScript.DomUtil.dc("a");
            cl_link.innerHTML = "<font color='red'>[x]</font>";
            cl_link.style.cursor = "pointer";
            // cl_link.style.marginRight = "20px";
            cl_link.addEventListener("click", function(e) {
                e.stopPropagation();
                _t.close();
            }, false);

            _t.capt = MigScript.DomUtil.dc("span");
            _t.capt.className = _t.prefix + "alert_capt";
            //            this.capt.style.float = "left";
            _t.capt.style.overflow = "hidden";

            head.appendChild(_t.capt);
            head.appendChild(cl_link);


            _t.body = MigScript.DomUtil.dc("div");
            _t.body.id = "al_" + _t.id + "_body";
            _t.body.className = _t.prefix + "alert_body";
            _t.cont.appendChild(head);
            _t.cont.appendChild(_t.body);
        };

        var serialize = function() {
            var alerter = {'id':   _t.id,'text':  _t.text, 'caption':  _t.caption, 'prefix':_t.prefix};
            if (MigScript.CustomObjects.serializableAlerters == null) {
                MigScript.CustomObjects.serializableAlerters = new Array();
            }
            MigScript.CustomObjects.serializableAlerters.push(alerter);
            MigScript.Util.serialize("alerts", MigScript.CustomObjects.serializableAlerters);
        };

        this.show = function() {
            createUI();
            this.isActive = true;
            clearTimeout(eval(_t.cont.getAttribute("timer")));
            this.capt.innerHTML = "<center><b>" + this.caption + "</b></center>";
            this.body.innerHTML = "<center>" + this.text + "</center>";
            serialize();
            render();
            if (MigScript.Settings.local_settings[16] > 0) {
                setTimeout(function() {
                    _t.close();
                }, MigScript.Settings.local_settings[16] * 1000);
            }
        };

        this.alert = function(caption, text) {
            this.isActive = true;
            this.text = text;
            this.caption = caption;
            if (this.id == 1) {
                this.show(caption, text);
            }
            //moveOut();
        };

        /*var moveOut = function() {
         this.cont.style.left = document.body.clientWidth;
         this.x = document.body.clientWidth;
         this.cont.setAttribute("x", uneval(this.x));
         var timer = setTimeout(function() {
         move();
         }, 20);
         this.cont.setAttribute("timer", uneval(timer));

         function move() {
         var left = _t.cont.style.offsetLeft;
         _t.cont.style.left = (left - 20) + "px";
         if (left < (document.body.clientWidth - 300 - 150 * Math.cos(Math.PI / 2 * MigScript.CustomObjects.alerters.length / 4))) {
         clearTimeout(eval(_t.cont.getAttribute("timer")));

         _t.x = left;
         _t.y = top;
         MigScript.CustomObjects.serializableAlerter = {'id':   _t.id,'text':  _t.text, 'caption':  _t.caption, 'x':  _t.x, 'y':  _t.y, 'prefix':_t.prefix};
         if (MigScript.CustomObjects.serializableAlerters == null) {
         MigScript.CustomObjects.serializableAlerters = new Array();
         }
         MigScript.CustomObjects.serializableAlerters.push(MigScript.CustomObjects.serializableAlerter);
         MigScript.Util.serialize("alerts", MigScript.CustomObjects.serializableAlerters);
         } else {
         timer = setTimeout(function() {
         move();
         }, 20);
         _t.cont.setAttribute("x", uneval(left - 20));
         }
         }
         };
         */
        var onDragStop = function() {
            if (_t.isActive) {
                var x = _t.cont.offsetLeft;
                var y = _t.cont.offsetTop;
                MigScript.Util.serialize(_t.prefix + "posX", x);
                MigScript.Util.serialize(_t.prefix + "posY", y);
            }
        };

        var remove = function () {
            onDragStop();
            _t.isActive = false;

            document.body.removeChild(_t.cont);
            for (var i = 0; i < MigScript.CustomObjects.serializableAlerters.length; i++) {
                if (MigScript.CustomObjects.serializableAlerters[i] != null) {
                    if (MigScript.CustomObjects.serializableAlerters[i].id == _t.id) {
                        MigScript.CustomObjects.serializableAlerters[i] = null;
                        break;
                    }
                }
            }
            ;
            MigScript.Util.serialize("alerts", MigScript.CustomObjects.serializableAlerters);
            showNext();
        };

        this.close = function() {
            MigScript.UI.animateHide(this.cont, remove);
        };

        this.init = function(prefix) {
            if (prefix) {
                this.prefix = prefix + "_";
            } else {
                this.prefix = "";
            }
            ;
            push();
        };
        this.init(prefix);
    },
    checkAlerts : function(id) {
        MigScript.CustomObjects.serializableAlerters = MigScript.Util.deserialize("alerts", new Array());
        if (MigScript.Util.notNullCount(MigScript.CustomObjects.serializableAlerters) == 0) {
            MigScript.CustomObjects.serializableAlerters = new Array();
        }
        MigScript.log("Serializable alerts is " + MigScript.CustomObjects.serializableAlerters);
        if (MigScript.CustomObjects.serializableAlerters != null) {
            for (var i = 0; i < MigScript.CustomObjects.serializableAlerters.length; i++) {
                var alert0 = MigScript.CustomObjects.serializableAlerters[i];
                if (alert0 != null) {
                    var alert1 = new MigScript.CustomObjects.AlerterClass(alert0.prefix);
                    alert1.alert(alert0.caption, alert0.text);
                }

                MigScript.CustomObjects.serializableAlerters[i] = null;
            }
        }
    }
};

MigScript.UI = {
    getOpaqueBg : function () {
        var el;
        el = MigScript.DomUtil.ge("hider");
        if (el == undefined) {
            el = MigScript.DomUtil.dc("div");
            el.id = "hider";
            el.style.height = document.height + "px";
            document.body.appendChild(el);
        } else el.style.display = "inline";
        return el;
    },
    createVkBtnSet:function () {
        var btns = MigScript.DomUtil.dc("div");
        btns.id = "buttons";
        var ul = MigScript.DomUtil.dc("div");
        ul.id = "btnset";
        ul.className = "nNav";
        var c = MigScript.DomUtil.dc("center");
        c.appendChild(btns);
        btns.appendChild(ul);
        return c;
    },

    addVkBtn : function (label, width, onClick) {
        var ul = MigScript.DomUtil.ge("btnset");
        if (ul != null) {
            var li = MigScript.DomUtil.dc("div");
            li.className = "vkbtn";
            li.style.width = width;
            ul.appendChild(li);

            var btn = MigScript.DomUtil.dc("div");
            btn.innerHTML = label;
            btn.style.display = "inline";
            btn.style.marginLeft = "10px";
            btn.className = "ncc";
            btn.addEventListener("click", onClick, true);
            btn.style.cursor = "pointer";
            btn.style.width = (width);

            li.appendChild(btn);

        }
    },

    showDFDialog : function (r, uid) {
        MigScript.UI.getOpaqueBg();
        MigScript.UI.Dialog.getDialog("Удаление из друзей");
        MigScript.UI.Dialog.showBlock(r);

        var fok_btn = MigScript.DomUtil.dc("div");
        fok_btn.id = "fr_ok_btn";
        fok_btn.className = "box_button";
        fok_btn.innerHTML = "Удалить";
        MigScript.DomUtil.ge("dlg_ok_btn").appendChild(fok_btn);
        // MigScript.log(uid);

        fok_btn.addEventListener("click", function() {
            MigScript.Menu.declineFriend(uid);
        }, true);
    },

    showAFDialog : function (r, uid) {
        MigScript.UI.getOpaqueBg();
        MigScript.UI.Dialog.getDialog("Запрос дружбы");
        MigScript.UI.Dialog.showBlock(r);

        var fok_btn = MigScript.DomUtil.dc("div");
        fok_btn.id = "fr_ok_btn";
        fok_btn.className = "box_button";
        fok_btn.innerHTML = "Добавить";
        MigScript.DomUtil.ge("dlg_ok_btn").appendChild(fok_btn);
        //MigScript.log(uid);

        fok_btn.addEventListener("click", function() {
            MigScript.Menu.acceptFriend(uid);
        }, true);
    },
    placeBookmarkStubs : function() {

        if (MigScript.Util.checkLocation("id") && MigScript.DomUtil.ge("addToFaves")) {
            MigScript.DomUtil.removeChildNodes(MigScript.DomUtil.ge("addToFaves"));
            var a = MigScript.DomUtil.dc("a");
            a.style.cursor = "pointer";
            if (MigScript.Friends.isFavFriend(MigScript.DomUtil.ge("mid").value)) {

                a.innerHTML = "Удалить из избранного";
                a.addEventListener("click", function(e) {
                    MigScript.Bookmarks.unbookAction(MigScript.DomUtil.ge("mid").value);
                }, false);
            } else {
                a.innerHTML = "Добавить в избранное";
                a.addEventListener("click", function(e) {
                    MigScript.Bookmarks.bookAction(MigScript.DomUtil.ge("mid").value);
                }, false);
            }
            MigScript.DomUtil.ge("addToFaves").appendChild(a);
        }
    },
    killAlerts : function() {
        for (var i = 0; i < MigScript.CustomObjects.alerters.length; i++) {
            if (MigScript.CustomObjects.alerters[i] != null) {
                MigScript.CustomObjects.alerters[i].onClose = function() {
                    MigScript.Util.serialize("alerts", null);
                };
                MigScript.CustomObjects.alerters[i].close();
            }
        }
        MigScript.log("alerts cleaned out");
    },
    createUI : function () {

        // Добавляем линк на настройки

        // Линк в отдельном диве рядом с баннером контакта

        var sett_div = MigScript.DomUtil.geByClass("moreDiv", null, "div")[0];
        var sett_link = MigScript.DomUtil.dc("a");
        sett_link.id = "sett_link";
        var txt = document.createTextNode("Mig[vk]Script");
        //    var sett_img = MigScript.DomUtil.dc("img");
        //    sett_img.src = MigScript.UI.Images.wrenchImg();
        //    sett_img.id = "sett_img";

        //    sett_img.style.width = "12px";
        sett_link.appendChild(txt);
        //    sett_link.appendChild(sett_img);

        var sett_li = MigScript.DomUtil.dc("li");
        sett_li.appendChild(sett_link);
        sett_li.style.cursor = "pointer";
        sett_link.addEventListener("click", function() {
            MigScript.UI.Settings.openSettings();
        }, true);
        MigScript.DomUtil.ge("nav").insertBefore(sett_li, sett_div);

        // Делаем финт ушами со всеми флешами
        try {
            var embed = MigScript.DomUtil.ge("flash_app");
            if (!embed) {
                embed = MigScript.DomUtil.ge("player");
            }
            if (embed) {
                embed.setAttribute("wmode", "opaque");
            }
        } catch(e) {
        }
        ;

        //Меняем меню
        MigScript.UI.MainMenu.init();
        MigScript.UI.MainMenu.extendMenu();


        //////// Добавляем кастомный фон полученных писем
        GM_addStyle(".mailbox table tr.newRow{background-color:" + MigScript.Settings.local_settings[5] + "!important;}");
        GM_addStyle(".mailbox table tr.newRow .messageBody {color:" + MigScript.Settings.local_settings[6] + "!important;}");


        //
        //Работа с фото         local
        //

        if (MigScript.Util.checkLocation("photo")) {
            //////// Добавляем линк "Отметить всех"
            var el = MigScript.DomUtil.dc("div");
            el.addEventListener("click", MigScript.Photo.markAll, true);
            el.innerHTML = "<br><b><a>Отметить всех</a></b>";
            el.style.cursor = "pointer";
            var el2 = MigScript.DomUtil.ge("photoactions");
            if (el2) {
                el2.appendChild(el);
            }

            //////// Добавляем линк "Удалить все отметки"
            if (MigScript.Photo.getTotalMarksNumber() > 0 && MigScript.DomUtil.ge("photoactions").childNodes.length > 8) {
                el = MigScript.DomUtil.dc("a");
                el.addEventListener("click", MigScript.Photo.deleteAllMarks, true);
                el.style.cursor = "pointer";
                el.innerHTML = "Удалить все отметки (" + MigScript.Photo.getTotalMarksNumber() + ")";
                MigScript.DomUtil.ge("photoactions").appendChild(el);
            }
        }

        if (MigScript.Util.checkLocation("photos")) {
            if (MigScript.Util.checkLocation("act=added")) {

                var c = MigScript.DomUtil.dc("center");
                div = MigScript.DomUtil.dc("div");
                div.id = "btnset";
                c.appendChild(div);
                //MigScript.DomUtil.ge("content").insertBefore(a, MigScript.DomUtil.ge("searchResults"));
                MigScript.DomUtil.ge("searchResults").appendChild(c);
                MigScript.UI.addVkBtn("<b>Я присутствую НА ВСЕХ фото</b>", "400px", function() {
                    MigScript.Photo.confirmAll();
                });
            }
        }


        //
        //	Работа с видео
        //

        if (MigScript.Util.checkLocation("video") && !MigScript.Util.checkLocation("gsearch")) {
            var text = document.documentElement.innerHTML;

            var url = MigScript.Video.getVideoUrl(text);


            var parent = MigScript.DomUtil.ge("videoactions");

            if (MigScript.Settings.local_settings[34]) {
                var link = MigScript.DomUtil.dc("a");
                link.href = url;
                link.innerHTML = "<b>Скачать<b>";
                if (parent) {
                    parent.appendChild(link);
                }
            }
            link = MigScript.DomUtil.dc("a");
            link.style.cursor = "pointer";
            link.innerHTML = "Отметить всех";
            link.addEventListener("click", function() {
                MigScript.Video.markAll();
            }, true);
            if (parent) {
                parent.appendChild(link);
            }

            //Удалить всех
            if (MigScript.Video.getTotalMarksNumber() > 0 && MigScript.DomUtil.ge("videoactions").childNodes.length > 7) {
                el = MigScript.DomUtil.dc("a");
                el.addEventListener("click", MigScript.Video.deleteAllMarks, true);
                el.style.cursor = "pointer";
                el.innerHTML = "Удалить все отметки (" + MigScript.Video.getTotalMarksNumber() + ")";
                MigScript.DomUtil.ge("videoactions").appendChild(el);
            }
        }

        //
        //	Работа с аудио
        //

        if (MigScript.Settings.local_settings[35]) {
            // Добавляем кнопки скачивания аудио
            if (MigScript.Util.checkLocation("audio.php") || MigScript.Util.checkLocation("id") || MigScript.Util.checkLocation("club")) {
                try {
                    MigScript.UI.placeADownLinks();
                    /*if (!(MigScript.Util.checkLocation("id") ? !MigScript.Util.checkLocation("gid") : MigScript.Util.checkLocation("gid")) || MigScript.Util.checkLocation("audio.php")) {
                     var a = MigScript.DomUtil.dc("a");
                     a.style.cursor = "pointer";
                     a.innerHTML = "Добавить ссылки на скачивание";
                     a.addEventListener("click", function() {
                     MigScript.UI.placeADownLinks();
                     }, true);
                     MigScript.DomUtil.ge("header").appendChild(a);
                     }*/
                } catch(e) {
                    MigScript.log(e);
                }
                var wrap = MigScript.DomUtil.ge("audiosWrap");
                if (wrap) {
                    wrap.addEventListener("DOMNodeInserted", function(e) {

                        if ((e.target.id != null) && (e.target.id == "audios")) {
                            MigScript.UI.placeADownLinks();
                        }
                    }, true);
                }
            }
        }

        //
        // Работа со страницей поиска
        //

        if (MigScript.Util.checkLocation("gsearch")) {


            // Аудио
            if (MigScript.Settings.local_settings[35]) {
                if (MigScript.Util.checkLocation("section=audio") || MigScript.Util.checkLocation("section\%5D=audio")) {
                    MigScript.UI.placeAsearchDownLinks();
                    /* var a = MigScript.DomUtil.dc("a");
                     a.style.cursor = "pointer";
                     a.innerHTML = "Добавить ссылки на скачивание";
                     a.addEventListener("click", function() {
                     MigScript.UI.placeDownLinks();
                     }, true);
                     MigScript.DomUtil.ge("header").appendChild(a);*/

                    var wrap = MigScript.DomUtil.ge("results");
                    if (wrap) {
                        wrap.addEventListener("DOMNodeInserted", function(e) {

                            if ((e.target.className != null) && (e.target.className == "audioRow")) {

                                var img = e.target.getElementsByTagName("img")[0];
                                MigScript.UI.placeAsearchLink(img);

                                /*var dimg = MigScript.DomUtil.dc("img");
                                 dimg.src = MigScript.UI.Images.downloadImg();
                                 dimg.style.width = "16px";
                                 dimg.style.padding = "1px";
                                 dimg.style.cursor = "pointer";
                                 // dimg.id = "dx" + aid;
                                 img.parentNode.style.width = "50px";

                                 var str = img.getAttribute("onclick");
                                 str = str.match(/[0-9]+,[0-9]+,[0-9]+,\'(\w+)\',[0-9]+/).toString();
                                 str = str.split(",");
                                 var href = "http://cs" + str[1] + ".vkontakte.ru/u" + str[2] + "/audio/" + str[5] + ".mp3";


                                 dimg.title = "Скачать";
                                 var a = MigScript.DomUtil.dc("a");
                                 a.href = href;

                                 img.parentNode.appendChild(a);
                                 a.appendChild(dimg);*/
                            }
                        }, true);
                    }
                }
            }


            // Видео
            if (MigScript.Settings.local_settings[34]) {
                if (MigScript.Util.checkLocation("section=video") || MigScript.Util.checkLocation("section\%5D=video")) {
                    if (MigScript.Settings.local_settings[10]) {
                        MigScript.UI.placeVDownLinks();
                    }
                    a = MigScript.DomUtil.dc("a");
                    a.style.cursor = "pointer";
                    a.innerHTML = "Добавить ссылки на скачивание";
                    a.addEventListener("click", function() {
                        MigScript.UI.placeDownLinks();
                    }, true);
                    MigScript.DomUtil.ge("header").appendChild(a);


                }
            }

        }

        //Заменяем кнопку "Удалить из избранного" и "Добавить в избранное" на странице друга
        MigScript.UI.placeBookmarkStubs();


        // Работа со страницей избранного
        if (MigScript.Util.checkLocation("fave.php")) {
            parent = MigScript.DomUtil.ge("Information").parentNode;
            if (MigScript.Settings.local_settings[33]) {
                var favedDiv = MigScript.DomUtil.dc("div");
                var headerDiv = MigScript.DomUtil.dc("div");
                headerDiv.innerHTML = "<div class=\"flexHeader clearFix\"><div><h2>Вы в закладках у этих людей</h2></div></div>";
                headerDiv.className = "bOpen";
                parent.appendChild(headerDiv);
                parent.appendChild(favedDiv);
                favedDiv.innerHTML = "<img src='" + MigScript.UI.Images.loaderImg() + "'/>";


                MigScript.WhoFaved.getList(function() {
                    favedDiv.innerHTML = "";
                    for (var l = 0; l < MigScript.WhoFaved.favedList.length; l++) {
                        var faved = MigScript.WhoFaved.favedList[l];
                        var d = MigScript.DomUtil.dc("div");
                        d.style.width = "60px";
                        d.style.setProperty("float", "left", "");
                        d.style.padding = "10px 2px 5px 2px";
                        favedDiv.appendChild(d);

                        var imgA = MigScript.DomUtil.dc("a");
                        imgA.href = MigScript.HOST + "/id" + faved[0];
                        imgA.style.cursor = "pointer";


                        var imgDiv = MigScript.DomUtil.dc("div");
                        imgDiv.style.overflow = "hidden";
                        imgDiv.style.height = "55px";
                        d.appendChild(imgDiv);

                        var nameDiv = MigScript.DomUtil.dc("div");
                        nameDiv.innerHTML = "<a href=\"" + MigScript.HOST + "/id" + faved[0] + "\">" + faved[1] + "</a>";
                        d.appendChild(nameDiv);

                        var img = MigScript.DomUtil.dc("img");
                        img.src = faved[2];
                        img.style.width = "55px";
                        imgA.appendChild(img);
                        imgDiv.appendChild(imgA);
                    }

                });

            }

        }


        // работа с профилями

        if (window.location.href.match(/id\d+/)) {
            var cont = MigScript.DomUtil.ge("activity_time");

            if (!cont) {
                var a = MigScript.DomUtil.dc("a");
                a.id = "activity_time";
                a.style.cursor = "pointer";
                a.style.fontSize = "8pt";
                a.innerHTML = "[История статусов пользователя]";
                var uid = window.location.href.match(/\d+/).toString();
                a.addEventListener("click", function() {
                    MigScript.UI.getActivityHistory(uid);
                }, false);

                var parent = MigScript.DomUtil.geByClass("accountInfo clearFix")[0];
                parent.appendChild(MigScript.DomUtil.dc("br"));
                var d = MigScript.DomUtil.dc("div");
                //d.style.setProperty("float","left","");
                d.id = "hlink_cont";
                d.style.padding = "2px";
                d.style.clear = "both";
                parent.appendChild(d);
                d.appendChild(a);
                //parent.appendChild(MigScript.DomUtil.dc("br"));
                cont = MigScript.DomUtil.dc("div");
                cont.id = "hist_cont";
                cont.style.borderTop = "1px solid #DAE1E8";
                parent.appendChild(cont);
                MigScript.DomUtil.hide(cont);
            }
        }


        //
        // Работа с группой
        //

        if (MigScript.Util.checkLocation("club")) {
            // Кнопка "Пригласить всех"
            var ul = MigScript.DomUtil.ge("addToFaves").parentNode;
            var li = MigScript.DomUtil.dc("li");
            a = MigScript.DomUtil.dc("a");
            a.innerHTML = "<b>Пригласить всех друзей</b>";
            a.id = "gr_frCall";
            a.style.cursor = "pointer";
            a.addEventListener("click", function() {
                MigScript.Group.callFriends();
            }, true);
            li.appendChild(a);
            ul.appendChild(li);
        }

        if (MigScript.Util.checkLocation("groups")) {

            // Кнопка "Выделить друзей"
            if (MigScript.DomUtil.geByClass("s_sep")) {
                var sep = MigScript.DomUtil.geByClass("s_sep")[0];
            }
            if (sep) {
                var new_sep = MigScript.DomUtil.dc("div");
                new_sep.className = "s_sep";
                sep.parentNode.insertBefore(new_sep, sep.nextSibling);

                var div = MigScript.UI.Group.createMngButton("Выделить друзей", "settings5", function() {
                    MigScript.UI.Group.markFriends();
                });
                sep.parentNode.insertBefore(div, sep.nextSibling);
            }


            //Кнопка "Выгнать всех не друзей на странице"
            if (MigScript.Group.isAdmin()) {
                div = MigScript.UI.Group.createMngButton("Выгнать всех не друзей на странице", null, function() {
                    MigScript.Group.kickNoFriends();
                });
                sep.parentNode.insertBefore(div, sep.nextSibling);
            }
        }

        if (MigScript.Util.checkLocation("topic")) {

            MigScript.UI.Group.addReplyButtons();
            MigScript.DomUtil.ge("rows_content").addEventListener("DOMNodeInserted", function(e) {
                if (e.target.className != null && e.target.className.match(/post/)) {
                    var ar = e.target.getElementsByTagName("div");
                    MigScript.UI.Group.addReplyButton(ar);
                }
            }, true);

        }

        // модуль слежения
        MigScript.UI.ExFriends.init();

        var adv = MigScript.DomUtil.ge("banner1");
        if (adv != null) {
            adv.style.display = "none";
            adv.innerHTML = "";
        }
        adv = MigScript.DomUtil.ge("banner2");
        if (adv != null) {
            adv.style.display = "none";
            adv.innerHTML = "";
        }
        adv = MigScript.DomUtil.geByClass("ad_box");
        if (adv) {
            for (var i = 0; i < adv.length; i++) {
                try {
                    MigScript.log("left_Ad href: " + adv[i].href);
                    if (adv[i].href.match(/ads.php/)) {
                        adv[i].style.display = "none";
                        MigScript.log("left_Ad href matched. Ad removed");
                    }
                } catch(e) {
                    try {
                        if (adv.href.match(/ads.php/)) {
                            adv.style.display = "none";
                        }
                    } catch(e) {

                    }
                }
            }
        }


        //////// Добавляем меню ко всем ссылкам на профили...
        if (MigScript.Settings.local_settings[1]) {
            document.body.addEventListener("mouseover", function(e) {
                MigScript.UI.addContactMenu(e, e.target, e.target.toString());
            }, false);
            MigScript.UI.purgeContactMenu();
        }

        //Прямые ссылки
        var links = document.getElementsByTagName('a');
        for (i = 0; i < links.length; i++) {
            if (links[i].href.split('away.php?to=').length == 2) {
                links[i].href = unescape(links[i].href.split('away.php?to=')[1]);
            }
        }

        //Останавливаем автоматическую усвтановку статуса
        var ae = MigScript.DomUtil.ge("edit_activity_text");
        if (ae) {
            ae.setAttribute("onblur", "");
        }

        //(new MigScript.CustomObjects.AlerterClass()).alert("Hello!", "<center>Здрасте!</center><br>Я - <b>всплывающее окошко</b>. Я буду вас информировать! (;");
    },

    placeVDownLinks : function () {
        var a_cont = MigScript.DomUtil.ge("results");
        for (var i = 0; i < a_cont.childNodes.length; i++) {
            var el = a_cont.childNodes[i];
            if (el.id != null && el.id.match(/video/)) {
                var vid = el.id.substring(5);
                var div = MigScript.DomUtil.ge("videoInfo" + vid);
                if (MigScript.DomUtil.ge("dx" + vid) == null) {
                    var xurl = div.childNodes[1].childNodes[0].href;
                    var _ajax = new MigScript.Ajax.AjaxClass(function(a, r) {
                        var vid = /vkid:.(.*?).,/.exec(r)[1];
                        //MigScript.log(vid);
                        var div = MigScript.DomUtil.ge("videoInfo" + vid);
                        a = MigScript.DomUtil.dc("a");
                        a.href = MigScript.Video.getVideoUrl(r);
                        a.innerHTML = "Скачать видео";
                        a.id = "dx" + vid;
                        var br = MigScript.DomUtil.dc("br");
                        div.appendChild(br);
                        div.appendChild(a);
                    });
                    _ajax.get(xurl);
                }
            }
        }
    },

    getActivityHistory : function (uid) {
        var ajax = new MigScript.Ajax.AjaxClass();
        ajax.get('/profile.php', {'activityhistory':'1', 'id':uid });

        MigScript.DomUtil.ge("activity_time").innerHTML = "<img src=\"" + MigScript.UI.Images.loaderImg() + "\"/>";
        ajax.onDone = function(a, r) {
            var c = MigScript.DomUtil.ge("hist_cont");
            MigScript.DomUtil.show("hist_cont");
            c.innerHTML = r;

            MigScript.DomUtil.removeChildNodes(MigScript.DomUtil.ge("hlink_cont"));

            var a = MigScript.DomUtil.dc("a");
            a.id = "activity_time";
            a.style.cursor = "pointer";
            a.style.fontSize = "8pt";
            a.innerHTML = "[Спрятать историю]";
            var uid = window.location.href.match(/\d+/).toString();
            MigScript.DomUtil.ge("hlink_cont").appendChild(a);
            a.addEventListener("click", function() {
                MigScript.DomUtil.hide("hist_cont");

                MigScript.DomUtil.removeChildNodes(MigScript.DomUtil.ge("hlink_cont"));

                var a = MigScript.DomUtil.dc("a");
                a.id = "activity_time";
                a.style.cursor = "pointer";
                a.style.fontSize = "8pt";
                MigScript.DomUtil.ge("hlink_cont").appendChild(a);
                a.innerHTML = "[История статусов пользователя]";
                var uid = window.location.href.match(/\d+/).toString();
                a.addEventListener("click", function() {
                    MigScript.UI.getActivityHistory(uid);
                }, false);

            }, false);
        };
    },

    placeAsearchLink : function(img, aid) {
        var dimg = MigScript.DomUtil.dc("img");
        dimg.src = MigScript.UI.Images.downloadImg();
        dimg.style.width = "16px";
        dimg.style.padding = "1px";
        dimg.style.cursor = "pointer";
        if (aid) {
            dimg.id = "dx" + aid;
        }
        img.parentNode.style.width = "50px";

        //Парсим исполнителя и название
        var infoc = img.parentNode.parentNode.getElementsByClassName("audioTitle")[0].childNodes;
        var perf, title;
        for (var j = 0; j < infoc.length; j++) {
            if (infoc[j].id != null) {
                if (infoc[j].id.match(/performer/)) {
                    perf = infoc[j].innerHTML;
                }
                else if (infoc[j].id.match(/title/)) {
                    if (infoc[j].childNodes != null) {
                        if (infoc[j].childNodes[0].tagName == "a") {
                            title = infoc[j].childNodes[0].innerHTML;
                        } else {
                            title = infoc[j].childNodes[0].textContent;
                        }
                    } else {
                        title = infoc[j].innerHTML;
                    }
                }
            }
        }

        // Не показываем дубликаты
        if (MigScript.Settings.local_settings[36]) {
            var dur = img.parentNode.parentNode.getElementsByClassName("duration")[0].innerHTML;
            var aobj = {'artist':perf.toLowerCase(), 'title':title.toLowerCase(), 'dur': dur};
            var f = false;
            for (var l = 0; l < MigScript.Audio.doubles.length; l++) {
                if (MigScript.Audio.doubles[l].artist == aobj.artist) {
                    if (MigScript.Audio.doubles[l].title == aobj.title) {
                        if (MigScript.Audio.doubles[l].dur == aobj.dur) {
                            img.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "none";
                            f = true;
                            break;
                        }
                    }
                }
            }
            if (!f) {
                MigScript.Audio.doubles.push(aobj);
            }
        }

        var str = img.getAttribute("onclick");
        str = str.match(/[0-9]+,[0-9]+,[0-9]+,\'(\w+)\',[0-9]+/).toString();
        str = str.split(",");
        var href = "http://cs" + str[1] + ".vkontakte.ru/u" + str[2] + "/audio/" + str[5] + ".mp3";

        perf = perf.replace("&amp;", "&");
        title = title.replace("&amp;", "&");

        dimg.title = perf + " - " + title;
        var a = MigScript.DomUtil.dc("a");
        a.href = href;

        img.parentNode.appendChild(a);
        a.appendChild(dimg);

        var lyr = MigScript.DomUtil.dc("a");
        lyr.style.fontSize = "8pt";
        lyr.innerHTML = "Слова";
        lyr.addEventListener("click", function() {
            window.open("http://www.lyricsplugin.com/winamp03/plugin/?artist=" + encodeURIComponent(perf.replace("'", "\\'").replace(/&amp;/g, "&")) + "&title=" + encodeURIComponent(title.replace("'", "\\'").replace(/&amp;/g, "&")) + "", "_blank", "width=300, height=500,scrollbars=1");
        }, false);
        lyr.style.marginLeft = "2px";
        img.parentNode.appendChild(lyr);
    },
    placeAsearchDownLinks: function () {
        var a_cont = MigScript.DomUtil.ge("results");
        MigScript.Audio.doubles = [];
        for (var i = 0; i < a_cont.childNodes.length; i++) {
            var el = a_cont.childNodes[i];
            if (el.id != null && el.id.match(/audio/)) {
                var aid = el.id.substring(5);
                if (MigScript.DomUtil.ge("dx" + aid) == null) {
                    var img = MigScript.DomUtil.ge("imgbutton" + aid);
                    MigScript.UI.placeAsearchLink(img, aid);
                }
            }
        }
    },

    placeDownLinks : function () {
        MigScript.UI.placeVDownLinks();
        MigScript.UI.placeADownLinks();
    },

    placeADownLinks : function() {
        var a_cont = MigScript.DomUtil.geByClass("playimg");
        if (a_cont) {
            for (var i = 0; i < a_cont.length; i++) {
                var img = a_cont[i];
                //var aid = el.id.substring(5);
                var dimg = MigScript.DomUtil.dc("img");
                dimg.src = MigScript.UI.Images.downloadImg();
                dimg.style.width = "16px";
                dimg.style.padding = "1px";
                dimg.style.cursor = "pointer";
                img.parentNode.style.width = "50px";

                var str = img.getAttribute("onclick");
                str = str.match(/\'.+'/).toString();
                str = str.replace(/\'/g, "");
                var href = str;


                //Парсим исполнителя и название
                try {
                    var infoc = img.parentNode.parentNode.getElementsByClassName("audioTitle")[0].childNodes;
                    var perf, title;
                    for (var j = 0; j < infoc.length; j++) {
                        if (infoc[j].id != null) {
                            if (infoc[j].id.match(/performer/)) {
                                perf = infoc[j].childNodes[0].innerHTML;
                            }
                            else if (infoc[j].id.match(/title/)) {
                                if (infoc[j].childNodes != null) {
                                    if (infoc[j].childNodes[0].tagName == "a") {
                                        title = infoc[j].childNodes[0].innerHTML;
                                    } else {
                                        title = infoc[j].childNodes[0].textContent;
                                    }
                                } else {
                                    title = infoc[j].innerHTML;
                                }
                            }
                        }
                    }
                }
                catch(e) {

                    //Аналогично для стены
                    infoc = img.parentNode.parentNode.getElementsByClassName("duration")[0].parentNode.childNodes[0].childNodes;
                    for (var j = 0; j < infoc.length; j++) {
                        if (infoc[j].id != null) {
                            if (infoc[j].id.match(/performer/)) {
                                perf = infoc[j].childNodes[0].innerHTML;
                            }
                            else if (infoc[j].id.match(/title/)) {
                                title = infoc[j].innerHTML;
                            }
                        }
                    }
                }

                perf = perf.replace("&amp;", "&");
                title = title.replace("&amp;", "&");

                dimg.title = perf + " - " + title;
                var a = MigScript.DomUtil.dc("a");
                a.href = href;

                img.parentNode.appendChild(a);
                a.appendChild(dimg);

                // Кнопка "Добавить"
                /* dimg = MigScript.DomUtil.dc("img");
                 dimg.src = MigScript.UI.Images.addMediaImg();
                 dimg.style.width = "16px";
                 dimg.style.padding = "1px";
                 dimg.style.cursor = "pointer";

                 str = img.getAttribute("onclick");
                 str = str.match(/\'.+'/).toString();
                 str = str.replace(/\'/g,"");
                 var href = str;

                 dimg.addEventListener("click", function(){addAudio(aid);}, false);
                 dimg.title = "Добавить к себе";


                 img.parentNode.appendChild(dimg); */
            }
        }
    },

    purgeContactMenu: function () {
        var anchors = document.getElementsByTagName("a");
        for (var i = 0; i < anchors.length; i++) {
            var chkStr = anchors[i].getAttribute("href");
            if (chkStr != null && chkStr.match(/id\d+/)) {
                if (chkStr.match(/\?/)) chkStr = chkStr.substring(0, chkStr.indexOf("?"));
                var uid = chkStr.substring(chkStr.indexOf("/id") + 3);
                if (uid != MigScript.myUid && anchors[i].getElementsByTagName("img").length == 0) {
                    MigScript.UI.Menu.addMenu(anchors[i], uid);
                }
            }
        }
    },

    addContactMenu : function (event, elem, chkStr) {
        if (chkStr.match(/id\d+/)) {
            if (chkStr.match(/\?/)) chkStr = chkStr.substring(0, chkStr.indexOf("?"));
            if (chkStr.match(/\#./)) return;
            if (chkStr.match(/\#/)) chkStr = chkStr.substring(0, chkStr.indexOf("#"));
            var uid = chkStr.substring(chkStr.indexOf("/id") + 3);
            if (uid != MigScript.myUid) {
                MigScript.UI.Menu.addMenu(elem, uid);
                MigScript.UI.Menu.showMenu(uid, elem, event);
            }
        }
    },

    togglePlusBtn : function (id) {
        var btn = MigScript.DomUtil.ge(id);
        if (btn) {
            if (btn.innerHTML == "[-]") {
                btn.innerHTML = "[+]";
                btn.title = "Развернуть";
            } else {
                btn.innerHTML = "[-]";
                btn.title = "Свернуть";
            }
        }
    },

    showHelloMsg : function() {
        var hello = MigScript.Util.deserialize("hello", false);
        if (!hello) {
            MigScript.UI.getOpaqueBg();
            MigScript.UI.Dialog.getDialog("<center>Новости MigScript</center>");
            MigScript.DomUtil.ge("dlg_body").style.overflow = "auto";
            MigScript.DomUtil.ge("dlg_body").style.minHeight = "100px";
            MigScript.DomUtil.ge("dlg_body").style.maxHeight = "300px";
            MigScript.UI.Dialog.showBlock(MigScript.helloMsg);

            var fok_btn = MigScript.DomUtil.dc("div");
            fok_btn.id = "hello_wr_btn";
            fok_btn.className = "box_button";
            fok_btn.innerHTML = "Написать автору";
            MigScript.DomUtil.ge("dlg_ok_btn").appendChild(fok_btn);

            fok_btn.addEventListener("click", function() {
                window.location.href = "http://vkontakte.ru/mail.php?act=write&to=4518704";
            }, true);

            MigScript.Util.serialize("hello", true);
        }
    },

    showAvatar : function(uid, x, dx, y, containerWidth, list) {
        console.log(containerWidth);
        var div = MigScript.UI.createAvatarBox(uid, list);
        clearTimeout(eval(div.getAttribute("timer")));

        div.style.opacity = "1";
        if (x < 150) {
            div.style.left = x + containerWidth + "px";
        } else {
            div.style.left = x - dx + "px";
        }
        div.style.top = y + "px";

        div.style.display = "block";
    },

    hideAvatar : function (uid) {
        var div = MigScript.DomUtil.ge("abox_" + uid);
        MigScript.UI.animateHide(div);
    },

    createAvatarBox : function(uid, list) {
        var div = MigScript.DomUtil.ge("abox_" + uid);
        if (!div) {
            div = MigScript.DomUtil.dc("div");
            div.style.width = "100px";
            div.style.maxHeight = "200px";
            div.id = "abox_" + uid;
            div.style.position = "absolute";

            div.style.zIndex = "3000";

            var img = MigScript.DomUtil.dc("img");
            var user;
            if (!list) {
                for (var i = 0; i < MigScript.Friends.friendList.length; i++) {
                    if (uid == MigScript.Friends.friendList[i][0]) {
                        user = MigScript.Friends.friendList[i];
                        break;
                    }
                }
                img.src = user[2];
            } else {
                for (i = 0; i < list.length; i++) {
                    if (uid == list[i][0]) {
                        user = list[i];
                        break;
                    }
                }
                img.src = user[2];

            }
            img.style.border = "1px solid #B1BDD6";
            div.appendChild(img);
            document.body.appendChild(div);
        }
        return div;
    },

    animateHide: function (element, onHide) {
        if (element != null) {
            if (MigScript.Settings.local_settings[39]) {
                var timer = setTimeout(function() {
                    fadeout(0);
                }, 20);
                element.setAttribute("timer", uneval(timer));
            }
            else {
                element.style.display = "none";
                if (onHide) {
                    onHide();
                }
            }
        }

        function fadeout(mod) {
            if (element.style.opacity == 0 && !element.style.opacity == "") {
                element.style.display = "none";
                if (onHide) {
                    onHide();
                }
            } else {
                element.style.opacity = (1 - 0.1 * mod);
                timer = setTimeout(function() {
                    fadeout(++mod);
                }, 20);
                element.setAttribute("timer", uneval(timer));
            }
        }
    }
};

MigScript.UI.Images = {

    noDataImg:function() {
        return "http://vkontakte.ru/images/question_b.gif";
    },

    loaderImg : function () {
        return "http://vkontakte.ru/images/upload.gif";
    },

    mailImg : function () {
        return"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%20cHRM%00%00z%25%00%00%80%83%00%00%F9%FF%00%00%80%E9%00%00u0%00%00%EA%60%00%00%3A%98%00%00%17o%92_%C5F%00%00%02%B4IDATx%DA%A4%92%CF%8A%1Ce%14%C5%7F%DF%9F%AE%9A%EE%AA%EE%9E%99%EE%C9L%08%89%12%06%95%20%EE%04%03B%DE%C0%85D%9F%C0%9D%E0%3B%E4%09%5C%E7%05%02%9A%9D%2B%17%8A(%E2.%84%88%0E!%CE%1F%C6q%88%3D%3D%FD%A7%BAz%BA%EA%AB%AF%EA%BB.%3A%E8%C6%5D%0E%1C%EE%D9%9C%C3%3D%97%ABD%84%D7%81%E65a%9F%3F%FA%F4%FD%ED%F7%3E%F9%3Cj%F7Z(%9D%0A%08!ht%ABQ%DAH%A8%9D%15%11%25%12D%1B%8B%2BV%E1%E4%E0%C9%8F7%06%D1%F7%FE%E2%E9oj%F4%EC%EB%C7%AD%FD%8F%EF%B7c%C5%86%D1%FC_!%F5j%CE%F2%25%B3%CB%19%7F%9D%8D)%7C%C1%9D%DB%C3%AF%B4A%87~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%E7%2B%BFwuU%F4%D2n%AF%7Cs%D0%3CP%07%0F%EF%FE%F7%F4%12%40%02%22%CDZ%23(%A5%D1v%03%1D%A5%98%CE0%D2%EDk%03%9D%EC%5E%A7v%8B%E2%FC%97%C3%7F%06%00Pmx%02S%8Cjl%00%00%00%00IEND%AEB%60%82";
    },

    wrenchImg : function () {
        return "data:image/gif,GIF89a%20%00%20%00%C4%1F%00)h%A7%99%B9%D1%8C%CA%E9_%8A%AD%0DP%86%D8%EB%F6%E9%F3%FA%F3%F7%FA%A7%D5%EDP%93%CC%CF%DC%E7Ex%A0%C4%E1%F2%B3%D9%EEf%93%C4%AF%C5%D9%7C%C1%E5u%A2%C9%E1%EF%F8%A3%CA%E4W%B4%E2%B4%CC%E5%26b%96%BD%DC%EFo%BE%E5%D1%E3%F0%7F%A1%BD%C0%D1%DF%DF%E8%F0A%7C%BD%00E%7C%FF%FF%FF!%F9%04%01%00%00%1F%00%2C%00%00%00%00%20%00%20%00%00%05%FF%E0'%8A%CAb%0E%DB%A8%AEl%FBi%96%A6-%9E%E3%DE%AEFT%C7%A1%10%03%9Cp%A4%EB%F0%7C%9E%C0%B0Uz%7C%0E%16B%E4%608%C0%96%AC%85%25%F9%1B%18%BE%86%8D%07%BBJF%3C%40%B0Dr%F0(%C8%A3d%23%B2(%AC%25%F6%8C%E7%00%17y%22%0C%0D%0D%05%84%85%0C%40%7D%1FZ%12%17%0D%17%19%84%19k%13%88p%0E%04%0E%12%81%82%82%0C%08%12%0F%95X%1C%04%16%09%0F%92%19%13%83%0D%02%12%94Ad%01%1E%16%1D%B6%B6%13%0C%06%08%02%05%01%A2K%A1%04%A5%16%00%1D%B9%06%AD%BE%C0C%06%01%264%C6%C8%BC%CB%B1%89%B3%C6%17%BA%CA%BF%D6%7D%D8%1D%05%0C%05%D4%DD%0A%1B%1C%DF%1E%00%0E%05%DA%E5%04%1E%F21p%D8%ED%82%BC%17%AB%12%1C%01%16%16%7C%B0%D8%2B%C0%09A%03%04%08%2F%18%B0%B0%A0%DE%BAL%08%23N%40%B0%8A%94%12Y%0F%25%F0%12%C0%B1%23%83%01%0D%1D%02P%20%A1%23%C7%04%10%7C%5BY%B8%E6%C1%0E%84%97%10%12%18%AB0%2B%11%07%0F%15%0C%BC%C4%90%A0%03%1A%5Bc%FA%B4%99%02%81'%00%0F%03%A2DI%F4%81%00%00%82%14%12xh%08%05)%D3%01%04%3A0%10%40%C1%A7%93%03)%98%92%AA%E5%20%26%01%0DLW%FCpj%EBlZ%B54%D0%24y%CB%82%C3%86%BB%2CB%00%00%3B";
    },

    warningImg:function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00(%00%00%00(%08%06%00%00%00%8C%FE%B8m%00%00%00%19tEXtSoftware%00Adobe%20ImageReadyq%C9e%3C%00%00%07%5EIDATx%DA%CC%99kl%1C%D5%15%C7%FF%B3%EB%DD%B5%1D%E3Gb%C7I%9C%10%EC%80%F32y%D5i%20n%1C%92%40%1CDR%5E1%24!%81%3CJi%D2B%5BA%85T%A9%25%A2I%00%8B%14%24T%BEQU-%AD%10%CF%0F%A9%D4%0F%0D%C8%11%E2!!%9E%82%24H%20%5E!%90%C6q%FC%98%9D%D9%DDy%DC%FE%CF%EC%5Dgwm%D7%EB%10j%8F%F4%D3%DE%1D%CF%CE%FD%CF9%E7%9Es%EE%D8PJa%3C%1F%C6%05%BC%D7rr%23q%C8%8B%E4%03%3D%1E%17%16%B8%84%BC%40zH7y%8E4%91%E2%F1%20%AE%8C%1C%AF%2C%0D%AB%7B%DA%97%AA%3B%AFiPQ%23%B0%DA%DBd%26%89%8E%B5%C0%FD%E2%C6%C3%8F%EFT%CA%FB%5C%A9%F8%7B%EA%C9%1D%F3%95v%ED%01RK%C2c%25N%2Cdn%5D1C%A9o%8F(%D5uL%A9%9EO%95%FB%FESjy%9D!%02O%93%15%DA%CAcr%BCT%11%83%3A%F9%AF%07%95%EA%FEH%A9%AF%DFR%EA%24%E9%3D%A6%5E%EB%B8N%19i%2B%BE%A8c4r%3E%13%84%BE%83%B8%D5%E4%86%FB%DA%9B1%B5y%15%10%E7%FA%F0%12%80K%CC%5E%2C%DF%B8%13%9B%16%97%CAu%EB%C92m%C5Qg%8D%F3%8D%0Dy%B0ggN%8CL%FB%DB%C1_%23ZY%C7%84b%D1%5E%1Eq%01%3FI9%D5XX%15%C7%9F%0F%7D%10v%14%A6%F3%FA%7F%93~%E2%FD%3F%04%FE%82%EC%FA%CB%BDk%D1%B4r%03%8E%7F%11%C7%99~%07%5D%03%B8%E8%EAN%A0q%EE%A5%08%7D%D9%89%97%8F%C7E%E0%E7%E4cb%8F%267%9EO%A2%AE%26G%D74M%AA9%FC%8F%3F%E0%AC%3B%19%FF%3C%EA%C0%C8%BA%93%D2%26%BEi!%5D%7C%A2%13%0B6%3D%86OzpBB%82%1C%23%D6%F7%19%83%BF%E3%8Fj%3A%F6%AC%03J*a%24%7B%E1%24-%24%13%16R%19l%0B%5E%CA%82%B2%BBP2k%09%F6m%99%23%BF%13%2B%EE%22%13G%E3%B9%D1%0A%9CM%EE%DA%BD%AE%01K~%F4C%A0%EF%2CBn%1C%B6%15G%3C~%0E%93%24%13q%84%F97%98%16ni_%8F%D6%99%81%89o%23%F3%C8%84%EFK%E0%135eE%B1%07~%B2%96%8B%82%8EL%F5!%ECQ%8CMaf%AE%C8%14%CF%19%0E%05%DA%DD0*%EA%F0%F8O%9B%111P%CE%7B%DC%AB%C3%24r%A1%05n%20%D7%FC%B6%FDr%D4%D4%CF%A0e%CER%60%DAJ%0E%AD%D5%9F%25P%C6%220%B0%A0%88%EC%EF%C1%E2%D6V%EC%BC%22H%3BW%93%95%A4%BC%905P%A8%40%A9%A7%1D%F3%EA%26%60w%FB%15%9C%90%93%A6%CC%40%60%C43%99%FAL%8A2ajd%9C%B2M%BA%DFL_%C78%85%1F%C1%03%DB%96%A2%A6%24%98%F3Wd2%89%5D(%81%7B%C8%9C%C7v-E%EC%22%86%8F%CD%09%9D%F4%E4aw%B0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C%0F%B1p%CA%60%2B6%D5j%91%05%EE%82S%BCO%84%E6*%A1%3F%1B%AA%80%B7N%04i%A7Z%04%BEAn~%EA%95%2Fg%5C%B5%F0(j'U%23%E4%5BA2V%B2%01g%AB%A2%20%AB%95%B3%19%82%CF%B5%CF%B5%1BJ7%1E%B2%5E%0E%5E%8B%9Cmg%E6%BCX'%5C%60K%2C%E5C%BC%F6*%DB%86%23%9F%05%A7%CE%20%1D%E2A%0C%DEI%0EV3%877%D6%EAJ%93%F3%E6U%E5%7C%0C%B5%EF6%06'%8F%D1%BDI5%D2%D6%FE%F0%14%DD%ED%04o%1F%9E%20%87%0C%5DM%CAu-%DC*%8BE%9F%BB%90o_%0B%3Dd%CDw%91N%F2%BA%B4aF%96%85%C5%92%CCF%A8%D1%F50%84%B19%7C%FD%E6%81%B6%C47F%5E%5D%8E%E9%D7%B6%911%B2%60%26%3A%9C%E1%1A%D8%F1%F7%96%7F%BC%FF%1B%E2%BF%02%0C%009Q3%A7%E5'%C82%00%00%00%00IEND%AEB%60%82";
    },

    checkedImg : function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%04sBIT%08%08%08%08%7C%08d%88%00%00%00%09pHYs%00%00%0B%12%00%00%0B%12%01%D2%DD~%FC%00%00%00%25tEXtSoftware%00Macromedia%20Fireworks%20MX%202004%87v%AC%CF%00%00%03MIDAT8%CBm%93mL%14t%00%C6%FF%5E%EB%83%5B%AB%CD%84%A9%04%93EE%BC%2B%8E%3B%18%DC%C1%C1%BD%C8%C5%C9%84%08%26B%40%170c%92%C1%99dc%8B%82%96%B61%0A%C7%01%1B3%DED%D1%C1%40%E4%0E%0C8%91%8C%F4%B8%80%16b%20%83%AD%24!%B10%E0x%F9%F5%A16%17%E3%C3%B3%E7%CB%F3%FC%3E%3D%8F%00%C4f%09!%DC%C5v%A1%16%AE%22A%F8K%92v*%F7%EA2R%DE%F3%D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C%1C%8EU%00%86%A6%EC%A8Z%E4%C4%DEQ%A1%BF%A5%22%AAWN%E4%CD0%BC%FA%DD%D1%9D%3F%F8%E7%E2%DF%F3%89%02%10%3E'%03*%B4m%07(Z4%20%BD%1C%40%DF%B8%15%80%CF%ACE%04%99%BD%89%FDA%83%CA%1AN%A8%25%84%F01).%B5NT%F4%98l%80%B3%00%C4%B5%2B%E6%40%9F%22%EFQ%FDu)iSZ%8C%DF%9E%A0%DD%D6%81%E2B(%DA%81%08%A2%FA%14(o%CA%09%FFY%86%CB%25g%0C%0D%86%C5%95%E5%95%D4%A7S%16%88%F2fS%82%EC%AC%EC%AE%BC%CD%97%88%5E_%14%DD%FB%88%B1%2B9%3C~%90%A8%E1P%7Coy%E0%DA%B0%8B%8C%FA%8C%A5%99%D9%99B%40%B2%F9L%92%07%13%0F%22%DF%A9y%B7-%BC*l%F6%C0%25%2F%3C%9Aw%E3v%D1%09%AF%FAW%D0%D6%A8%9F%94v%95%DA%80t%E0%99-%DF%F8%9F%9E%BF71%F9F%85%B9%FA%D3%B2%CE%F2oL%D7%AB%1A%5B%07%DB%CA%D6%96%D6%93%81%3D%9B%F3%FF%00%3B%1A%83%A6%60IO%81%00%00%00%00IEND%AEB%60%82";
    },

    uncheckedImg :function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%04sBIT%08%08%08%08%7C%08d%88%00%00%00%09pHYs%00%00%0B%12%00%00%0B%12%01%D2%DD~%FC%00%00%00%25tEXtSoftware%00Macromedia%20Fireworks%20MX%202004%87v%AC%CF%00%00%02%92IDAT8%CBuS%DDK%93a%14%7F%2F%A3%9B%A0%3F%A3%A0%95z%1D%E1%5D%18%89t%93%E9EF%C1%BCi%A0%0C%BA%A8%0B%C1%8B%90%0Dw%D7%C5%B6%84%8D%7D(s%939e%C3%F9%3Du_%BA1%DD%97%EEKm%B4j%91s%0B%1B2N%CF%EF%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84%C6%C16%94%06%12(%9C%9E%9E%C60%FD%AA%D7%EB%7D-%A3%BC%B0%B0%D0g0%18%F2%18%12d%5D__%E7fA%05%80%B8Cf%11W%13%96%BFn%FB3%89%12%BA%E6%E7%E7MV%AB%B5%04%9F%D1iQ%2B7L%9C%7F%08%F9%5E%11%F7%E8%BF%7F%E3%9F%7D-%99L%3E%11%A5%A8E%19V1%03vA%AC-%97%CB%CF%C5%B7%9BW%E3%7F%03%93!%1E%C3%FD%3E%E7%CB%00%00%00%00IEND%AEB%60%82";
    },

    deleteImg:function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%04sBIT%08%08%08%08%7C%08d%88%00%00%00%09pHYs%00%00%0B%12%00%00%0B%12%01%D2%DD~%FC%00%00%00%25tEXtSoftware%00Macromedia%20Fireworks%20MX%202004%87v%AC%CF%00%00%03'IDAT8%CBm%93yH%D3a%18%C7_%0D%02%83%A2%E8%8FH%FB%A7%84%10%C5%8A4%F2(g%BB%CAc%D3%A6%3B%F2v%1A%06%F3H%9CL%85J%2B%8C%8A4%8F%0E%A8%C8%2C*%B1C%C8%7F%CA%03%95V%E613%D3%99%96i%9Bk%EA%5C%B6%D2%A9s%BFo%BF%8D%1Ae~%E1%E1y%E0%7D%3E%DF%E7%E5%3D%08%00%B2%3Ch%B9m'%84%B5%8F%10!%8F8%1F%89w%DD%C2K%15%88%BDV%EC%5D%06%AE%95%10%22-%DB%BC%BE%EE%C5!%BF%09%A5%88%0D%A5%90%85%A6%B0%C0%99%FB%BE%9EmW%F6%05%9C%AAm%EF%DC%BE%A2%81%1B!%5BO%AEv%AEj%8E%08%B6h%2FdS%F3W%F3%AC%0B%97%B3%ADs%C5i%D4%5CQ%B2U%AF%88%B5%BC%89fXj%82%FC%94%8D%D5wy4%E3%E40%A0%B5%AE%D0%C5%F9%EE%AB%04%DE%82%A9%BA%D8%3As%3E%93%1A%97%C7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%14%ED%81%89%9E%AAOf%A2W%7C%80jII%B0%E8U%AA%0A%9AY%F3%DFg%1A5%2F%EEm%CE%95%3Fh%88%0A%D3%B6K%B8P%09%F7C%15%15%807B%26Zc%0F%9B%BB%CF%9FS%5B%16-%D9t%AF%CB%8A%BF%F1w%B8%E8%B5%13%DC%9E%1B%B7%8ATe%E5U%BD%D7%AF%3F%1C%AC%A9%BDf%D2%E9%D3%E85%F7%E5%FD%BF%00m%5D%A9%A0%60%E2%F3k%00%00%00%00IEND%AEB%60%82";
    },

    photoImg : function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%09pHYs%00%00%09%D8%00%00%09%D8%01%C7%A0%B9%AD%00%00%0AOiCCPPhotoshop%20ICC%20profile%00%00x%DA%9DSgTS%E9%16%3D%F7%DE%F4BK%88%80%94KoR%15%08%20RB%8B%80%14%91%26*!%09%10J%88!%A1%D9%15Q%C1%11EE%04%1B%C8%A0%88%03%8E%8E%80%8C%15Q%2C%0C%8A%0A%D8%07%E4!%A2%8E%83%A3%88%8A%CA%FB%E1%7B%A3k%D6%BC%F7%E6%CD%FE%B5%D7%3E%E7%AC%F3%9D%B3%CF%07%C0%08%0C%96H3Q5%80%0C%A9B%1E%11%E0%83%C7%C4%C6%E1%E4.%40%81%0A%24p%00%10%08%B3d!s%FD%23%01%00%F8~%3C%3C%2B%22%C0%07%BE%00%01x%D3%0B%08%00%C0M%9B%C00%1C%87%FF%0F%EAB%99%5C%01%80%84%01%C0t%918K%08%80%14%00%40z%8EB%A6%00%40F%01%80%9D%98%26S%00%A0%04%00%60%CBcb%E3%00P-%00%60'%7F%E6%D3%00%80%9D%F8%99%7B%01%00%5B%94!%15%01%A0%91%00%20%13e%88D%00h%3B%00%AC%CFV%8AE%00X0%00%14fK%C49%00%D8-%000IWfH%00%B0%B7%00%C0%CE%10%0B%B2%00%08%0C%000Q%88%85)%00%04%7B%00%60%C8%23%23x%00%84%99%00%14F%F2W%3C%F1%2B%AE%10%E7*%00%00x%99%B2%3C%B9%249E%81%5B%08-q%07WW.%1E(%CEI%17%2B%146a%02a%9A%40.%C2y%99%192%814%0F%E0%F3%CC%00%00%A0%91%15%11%E0%83%F3%FDx%CE%0E%AE%CE%CE6%8E%B6%0E_-%EA%BF%06%FF%22bb%E3%FE%E5%CF%ABp%40%00%00%E1t~%D1%FE%2C%2F%B3%1A%80%3B%06%80m%FE%A2%25%EE%04h%5E%0B%A0u%F7%8Bf%B2%0F%40%B5%00%A0%E9%DAW%F3p%F8~%3C%3CE%A1%90%B9%D9%D9%E5%E4%E4%D8J%C4B%5Ba%CAW%7D%FEg%C2_%C0W%FDl%F9~%3C%FC%F7%F5%E0%BE%E2%24%812%5D%81G%04%F8%E0%C2%CC%F4L%A5%1C%CF%92%09%84b%DC%E6%8FG%FC%B7%0B%FF%FC%1D%D3%22%C4Ib%B9X*%14%E3Q%12q%8ED%9A%8C%F32%A5%22%89B%92)%C5%25%D2%FFd%E2%DF%2C%FB%03%3E%DF5%00%B0j%3E%01%7B%91-%A8%5Dc%03%F6K'%10Xt%C0%E2%F7%00%00%F2%BBo%C1%D4(%08%03%80h%83%E1%CFw%FF%EF%3F%FDG%A0%25%00%80fI%92q%00%00%5ED%24.T%CA%B3%3F%C7%08%00%00D%A0%81*%B0A%1B%F4%C1%18%2C%C0%06%1C%C1%05%DC%C1%0B%FC%606%84B%24%C4%C2B%10B%0Ad%80%1Cr%60)%AC%82B(%86%CD%B0%1D*%60%2F%D4%40%1D4%C0Qh%86%93p%0E.%C2U%B8%0E%3Dp%0F%FAa%08%9E%C1(%BC%81%09%04A%C8%08%13a!%DA%88%01b%8AX%23%8E%08%17%99%85%F8!%C1H%04%12%8B%24%20%C9%88%14Q%22K%915H1R%8AT%20UH%1D%F2%3Dr%029%87%5CF%BA%91%3B%C8%002%82%FC%86%BCG1%94%81%B2Q%3D%D4%0C%B5C%B9%A87%1A%84F%A2%0B%D0dt1%9A%8F%16%A0%9B%D0r%B4%1A%3D%8C6%A1%E7%D0%ABh%0F%DA%8F%3EC%C70%C0%E8%18%073%C4l0.%C6%C3B%B18%2C%09%93c%CB%B1%22%AC%0C%AB%C6%1A%B0V%AC%03%BB%89%F5c%CF%B1w%04%12%81E%C0%096%04wB%20a%1EAHXLXN%D8H%A8%20%1C%244%11%DA%097%09%03%84Q%C2'%22%93%A8K%B4%26%BA%11%F9%C4%18b21%87XH%2C%23%D6%12%8F%13%2F%10%7B%88C%C47%24%12%89C2'%B9%90%02I%B1%A4T%D2%12%D2F%D2nR%23%E9%2C%A9%9B4H%1A%23%93%C9%DAdk%B2%079%94%2C%20%2B%C8%85%E4%9D%E4%C3%E43%E4%1B%E4!%F2%5B%0A%9Db%40q%A4%F8S%E2(R%CAjJ%19%E5%10%E54%E5%06e%982AU%A3%9AR%DD%A8%A1T%115%8FZB%AD%A1%B6R%AFQ%87%A8%134u%9A9%CD%83%16IK%A5%AD%A2%95%D3%1Ah%17h%F7i%AF%E8t%BA%11%DD%95%1EN%97%D0W%D2%CB%E9G%E8%97%E8%03%F4w%0C%0D%86%15%83%C7%88g(%19%9B%18%07%18g%19w%18%AF%98L%A6%19%D3%8B%19%C7T071%EB%98%E7%99%0F%99oUX*%B6*%7C%15%91%CA%0A%95J%95%26%95%1B*%2FT%A9%AA%A6%AA%DE%AA%0BU%F3U%CBT%8F%A9%5ES%7D%AEFU3S%E3%A9%09%D4%96%ABU%AA%9DP%EBS%1BSg%A9%3B%A8%87%AAg%A8oT%3F%A4~Y%FD%89%06Y%C3L%C3OC%A4Q%A0%B1_%E3%BC%C6%20%0Bc%19%B3x%2C!k%0D%AB%86u%815%C4%26%B1%CD%D9%7Cv*%BB%98%FD%1D%BB%8B%3D%AA%A9%A19C3J3W%B3R%F3%94f%3F%07%E3%98q%F8%9CtN%09%E7(%A7%97%F3~%8A%DE%14%EF)%E2)%1B%A64L%B91e%5Ck%AA%96%97%96X%ABH%ABQ%ABG%EB%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%81%90%08!%90%D6Z%86%F6%AD%B5%18c%08%82%00%A5%14%BF%FB%7D%3E%7D%F9%C1%A5%DB%CFh%0D%AEp%D0%DA%23I%12%FA%FD%3E%EDv%9B%C1%60%80*%8AbtYkMQ%14DQD%9A%A6%D4%EBu%EE%DD%5D%22%A8%ECqk%A9Lcz%06k-%ADV%8BV%AB%C5%C9%C9%09%CA%18CQ%14%18c%18%F6%BD%5E%8Fn%B7K%10%04%3C%7F%F2%88%EF%7B%7B%88k%D7%19%1B%F3%D1Z%D3%EF%F7q%1C%07)%25r8%98%E7%F9hQ%18%86%EC%EE%EE%12E%11%9EWfqa%91%A9%A9%06%95J%85%E3%E3c%CE%CF%CF%B1%D6%22%84%409%8E%23J%A5%12%9E%E7!%A5%A4(%0A%AC%B5%1C%1C%1C%A0%B5fnn%8E%24I0%C6%D0%E9t%E8t%3AT%ABU%AC%B5%B8%AE%2BT%ADV%8BWVV%88%A2h%C4%22%CB%B2Q%A4q%1C%8F%DC%D5j5%7C%DF%C7%18C%92%24%B8%AE%9B%89f%B3%B91%3F%3F%7F%C7%18%23%8C1Xk%FFb2%ACaZ%C3%A4%B4%D6f%7F%7F%FF%A3%F8%EF%DF%F8g%00%DB3y9%1F%7By%F9%00%00%00%00IEND%AEB%60%82";
    },

    albumImg : function() {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%01sRGB%00%AE%CE%1C%E9%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%20cHRM%00%00z%26%00%00%80%84%00%00%FA%00%00%00%80%E8%00%00u0%00%00%EA%60%00%00%3A%98%00%00%17p%9C%BAQ%3C%00%00%00%09pHYs%00%00%0E%C3%00%00%0E%C3%01%C7o%A8d%00%00%00%18tEXtSoftware%00Paint.NET%20v3.08er%9C%E1%00%00%01qIDAT8O%A5%93KK%02a%18%85%BF%FET%24-%A4ET%12%24F%D0%85J%A4EH%11!%11%85%04a%17%5C%84%91%E9%B4jcD%94%24VfVR%16%9AfB%03%9A%A6%9B%16%FD%027.O%9EO%86%A2%20%BC%0C%9C9%DF%81%F7%3C%EF%0C%CC%B4%01%10%BC%DC%DE%BD%DA%A1%D1%8B%00%CA%B9%E5B%B9%5CnH%EC%88%1D%8F%82f%C4e%ABk%1B%CDo%26%60%C9%BE%02A%0A%C3%F6%AE%B7.i%9B%E9%F3%B6%05%08R%18%1C%9BN%A8%C5O%DCeJ8%8F%E7qx%AB%C2%17Q%A5%1FEU%9C%DCg%E5%8C%B6%99%3Em%9D%81%20%85aq%D9.%01%3F%95%CA~%20%18%7F%93%BAH%E4%E5%8C%B6%99n%B6LA%90%C2%60%9D%9D%83%3F%96E%E0!W%2BT%9F%22%94(%E0*%F9%8E%9B%E7%22%A2%2F%259%A3m%A6%0F%8F%8CA%90%C20a%B6%20%F4T%40%B8%AA%EBT%B5%90.%C9%D7!H9K%23%F0%98%C3%F8%A4%19%95JE%3A%3B%03F%13%04)%0C%A6%C1!Y8%88%BCB%09%A6%E0%3EMb%DD%17%83M%89H%ED_f%E4%0C%01tvzz%0D%10%A40t%F7%19a%F3%841%EA%F0%FF%11%01%AE%E3%B8%9C!%C0%60%E8%FF%06%90B%80N%D7Y%97%08%60%87%AE%D7wA%F0%F6%DF'%CC%C1%DFb%A7%BD%BDCJh%87F%5D%FB%87%E4%8F%D4%8AZ*s%F1%17%02%1D%C4%C92%3B%D3%FC%00%00%00%00IEND%AEB%60%82";
    },
    videoImg : function() {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%01sRGB%00%AE%CE%1C%E9%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%20cHRM%00%00z%26%00%00%80%84%00%00%FA%00%00%00%80%E8%00%00u0%00%00%EA%60%00%00%3A%98%00%00%17p%9C%BAQ%3C%00%00%00%09pHYs%00%00%0E%C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11%04%19%2B%23%7Fp%C0K%9D%F6%FA%E0d%CFg%187A%22%95%A1Q%22E%1B%3BYtM%C1%BF%B0%C8%1Bk%B1%DA9%FF%E6%ED%3B%20%AD%602M%C0%C9%EEL%DD%DD%DCJq%E8G%0D%F0%CC%CE%C1%C1%EE%DD%DC%D2%8A9%7F%80%BD%C44%AF%F2%C7a%01F%93%195%B5%D7%40Z%3E%07%D7o%DCB%3A%BD%83C%D6%DD%14%5B%3D3%5E%BCYZF(%1C%C1%0B%A5%8A%FB%08%14'%DE%A5%EA%CB%20Mi%90%E2%AC%FC%2BWk%B0%BD%BD%CD'.%C3%A61%B8%18%C6%DC%7C%00%EBlx%8A%93Hq%E2%9D%BFp%11%A4)%25%A0M%2C%B6%8A%AA%AAjV%96%1996%91%A7%8D%FE%B5l%84%2B%2B%CFq%0EqIS%96%A0%E8%18%D4h%D9)%B5%A8%A88%5B%06%F2Q%AC%C8%2B%AE%7F%01zn%D4%AF%F5Sj1%00%00%00%00IEND%AEB%60%82";
    },

    addImg: function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%20%00%00%00%20%08%06%00%00%00szz%F4%00%00%06%9EIDATX%85%CDVkl%5CG%15%FE%CE%CC%DC%DD%EB%7Dx%FD%8C%1F%B5%9D%D4Mb%B7%0E1I%0Di%A1%E1!%85%A2%22%A1%84%A2%F0%8F%A8%8EZQB%14)HD%ADT%A1%08%F5GA%02%83RB%A3%F4G%E5%FC%A9P%11%81F%3C%EA%22!R%1A%81%93F%81l%23%97%D8%9B8~%C7%BB%DE%5D%7Bw%EF%DDy%F1%C3%AE%95%F5%DA%8D%DB%0A%95%91%8Et5s%1E%DF%99s%EE7%87%AC%B5%F8%24%17%FBD%A3%FF%3F%00%10%1FF%F9%877v8)us%B7%B1%E6k%20%DBe%0D%EA%00%80%18fa)%CE%88%FD%A1Fl%3C%FF%A3M%97%E5z%7D%D2zz%E0%FB%23ma%CFd%8F%16%E7%CD%D1%CC%A8%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4%40CD%E6%ED%9E%E6%CA%CD%A8kq!%5C%5D%E6%D4%A0%08%0B%BD%06%00Y%26%2C%A0%D1%D0%16Fs%E5f%C8%BC%DD%F3%C4%40C%E4N%BB%92%1E%F0%8A%85%5D%CA%83%7B_%EB%16%84%2B%01%40%E2%96%F7%1E%A0%03%B0%1A%B0%DA%C2h%C0(%A7%0C%80%F2%08%F1kC0jQ%CFj%00%8E%C4%F6%ED%9D%08%86%81-%1B%B7%E0%EF7%86%5C%8F%0A%BB%00%FCeU%00Z%9Av2%1C%F74m%80%A5E6uY%0C%07%1A_.%0B%B8r%FD%E0%0B%FDe%7B%3F%7D%F3%20%B0%E4%A7%B5%B9%114%C2%A0%A5i%BF%13%40I%09%B4D%C4u%C2%08G8%00%B5%24%1F%FD%B9.%DAyx%26%05%0B%89P%88%C1%0D%84%A0%25JJP%02%C0H%F8%8C%13%84%D0%8B%C8i%F5%86%5B%EF%D2%F0%914W!%91%061%85%40%80%C3H%F8k%02%B0%D2%8E%E5%BC%2C%3C%93%04H-%CA%C7%B8%01%06%06%87q%E4%EC8%242(%F8yXi%C7%EE%D4)%25%22%C3%2FJ_%D9Y%2FA%0D%E1%7B%11%A0%08%3CL%E1%F4%C47%60%0C%A0%95%82T%1E%C8%AF%C6%91%AE_%97%98%FE%F8o%FB%A1%9D%D9ev%B4%1A0n%1A%01%16%03PDZ%26%90_%90%16%86%97%B0a%09%80%DF%F5f'%1E%7B)489%9B%FAlM8%02eS%A8%0F%05%00(X%AB%978%00%98%98%CC%94g%5B%91%C1%7D%9D%2B%89%B5n%F9%EBV2%89b%CE%0E%FE%F1%E9%ECD%E9-%ADXV%E2%D5%A1%EB%D30%C6B0%02%23%09F%0A%9CY8L%C0a%02%8C%A8%1C%00%B1%E5%F3%95B%60xwh%12V%E2%D52%BB%95%1B.%8F%9EJ%8E%FA%E3%97o%8E%C0a%0E%02%BC%5C%18%95Or%8C%D8%AA%BA%01%EE%20%3Ev%13S%89%DC%B8%CB%A3%A7%EE%0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1E%8F%23%1E%8FS%3A%9Df%9E%E7%09%AD5%D7Z%8B%A5%E0%CE%92%08k%AD%83%C5%A6%15%00%84%F6%C1%B37%AD%B2%D6%12c%2C%08%C0%C1%D2%13j%8CQD%C4%96%12d%8C1%D2zq%88%F1%7D%DFf%B3Y%93H%24%D8%85%0B%17LI%09%CE%9C9C%E7%CE%9D%A3D%22%C1%E6%E6%E6X%3E%9F%E7%C5b%91)%A5%B81%86%19c8%002%C6%10%169%E4%7DJ%B4%00%2C%11Y%222%8C1%C3%183%9Cs%1D%08%04%F4R)L%5B%5B%9B%D9%BBw%AF%E9%ED%ED%5D%0E%BA%AE%26%FC_%AE%FF%02%C5%7BW%C9%E5%8Ct%F8%00%00%00%00IEND%AEB%60%82";
    },

    visitImg :function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%18%00%00%00%18%08%06%00%00%00%E0w%3D%F8%00%00%03%C8IDATx%DA%B5%95%FBo%DBT%14%C7%CF%BD%B6%E3%BC%EB%AC%B4D%0D%1B%09Bj%BB%85%92%89%FD%01%19hhcl%A2%3C%3A%01c%A4%E3W%84%CA%1F%80%D6%FD%05%FB%81%3F%A0%81%B1%07%AF%15%86%40%1B%03%9C%F1%07%D0JKZMZ%D7%B4tS%9B4%89%9B%87%5B%DB%B1%CD%B9nW%98%60%24%95%B2%23%5D%3F%E5%EF%E7%9C%EF%3D%F7%9A%C0%FF%C4%C0%1B%DF%26%F0%94%04B%24B%08%5E%E2%20d%1A%0F%99%D9%AF%8E%2B%D0F%90%FFz%18%1F%B9r%1A_%7D%12%EA%F2E%03%C1%00%B8D%0FX%16%80i%D9P%AD%D5%A1Vo%80n43%08%3B%3Bs%E9h%E6Q%E2%FB%DE%BD%96x%08%D0%3F%FC%B5%84%1F%C9%7B%22%DD%89H_%18%08%E7%81%AAj%82%AA%99%80%DA%40)%05%9E%E3%00%F0ZU%1BP%A9%AC%82%A6%A9%0C4%9A%BBp%24%FF%90%F8%C9%EB%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C%E3q%0D%AD.%01%19%7C%EB%3Byh(%9El4T%B8%9B_L%CF%5C~u%B4-q%0E%C5%83a%89%0A%224%C1%D8%14%A7%C4%010%86%9B%BA%A0R%60%80%91%EFe%9C%E0%A4%BA%AE%C1%D2%BD%25%B6%F4%C7%5Bg%CE%C9%BE%40%AF%C4%A1%F8%B6(%DD%CA%1E%60%DB%26%A5%B4%CC%00W%CF%3D%B5%7B%CF%98%AE%1BP%5C-%B4%04%1C%F8%F0%0F%BB%1D%0B%1F%04%19%3Cq5%B5%2B%D43aS%01%D6%94%C2%D9%DC%C5W%C6w%22%D0%12%B0%F7%C4%0FQ%D1%ED%99wy%BA%A1%5E%5DF%C0%91%CE%02%D8a%EF%DB%3FN%F9%02%3D%09%B5QN%E7.%1Cn9%C9%3B%07%BC%F3SJ%14%FD%13%BA%A1N%E7%BE8%BC%BF%E3%00%16%F1%93%D7%E7%09%E5%A2%B8%17%85p%DBm%EBo%B5%23%00nd)%BC%9D%C0%3De4%7B%FEP%BA%E3%00%A7%8A%F7~%96%B1%81%95%EC%E7%87%86%1F%13%E0F%14%01S8b%D9%CF%5E%EA%88M%FF%FA%E9%C7%DF%FF5%89%AB0y%2B%FD%E2%F8c%01%B0%C0%AD8%8A%80%7C'%00%7F%01%07%12y%D2%AE%DE%DCu%00%00%00%00IEND%AEB%60%82";
    },

    downloadImg:function () {
        //return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%14%00%00%00%14%08%06%00%00%00%8D%89%1D%0D%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%0AOiCCPPhotoshop%20ICC%20profile%00%00x%DA%9DSgTS%E9%16%3D%F7%DE%F4BK%88%80%94KoR%15%08%20RB%8B%80%14%91%26*!%09%10J%88!%A1%D9%15Q%C1%11EE%04%1B%C8%A0%88%03%8E%8E%80%8C%15Q%2C%0C%8A%0A%D8%07%E4!%A2%8E%83%A3%88%8A%CA%FB%E1%7B%A3k%D6%BC%F7%E6%CD%FE%B5%D7%3E%E7%AC%F3%9D%B3%CF%07%C0%08%0C%96H3Q5%80%0C%A9B%1E%11%E0%83%C7%C4%C6%E1%E4.%40%81%0A%24p%00%10%08%B3d!s%FD%23%01%00%F8~%3C%3C%2B%22%C0%07%BE%00%01x%D3%0B%08%00%C0M%9B%C00%1C%87%FF%0F%EAB%99%5C%01%80%84%01%C0t%918K%08%80%14%00%40z%8EB%A6%00%40F%01%80%9D%98%26S%00%A0%04%00%60%CBcb%E3%00P-%00%60'%7F%E6%D3%00%80%9D%F8%99%7B%01%00%5B%94!%15%01%A0%91%00%20%13e%88D%00h%3B%00%AC%CFV%8AE%00X0%00%14fK%C49%00%D8-%000IWfH%00%B0%B7%00%C0%CE%10%0B%B2%00%08%0C%000Q%88%85)%00%04%7B%00%60%C8%23%23x%00%84%99%00%14F%F2W%3C%F1%2B%AE%10%E7*%00%00x%99%B2%3C%B9%249E%81%5B%08-q%07WW.%1E(%CEI%17%2B%146a%02a%9A%40.%C2y%99%192%814%0F%E0%F3%CC%00%00%A0%91%15%11%E0%83%F3%FDx%CE%0E%AE%CE%CE6%8E%B6%0E_-%EA%BF%06%FF%22bb%E3%FE%E5%CF%ABp%40%00%00%E1t~%D1%FE%2C%2F%B3%1A%80%3B%06%80m%FE%A2%25%EE%04h%5E%0B%A0u%F7%8Bf%B2%0F%40%B5%00%A0%E9%DAW%F3p%F8~%3C%3CE%A1%90%B9%D9%D9%E5%E4%E4%D8J%C4B%5Ba%CAW%7D%FEg%C2_%C0W%FDl%F9~%3C%FC%F7%F5%E0%BE%E2%24%812%5D%81G%04%F8%E0%C2%CC%F4L%A5%1C%CF%92%09%84b%DC%E6%8FG%FC%B7%0B%FF%FC%1D%D3%22%C4Ib%B9X*%14%E3Q%12q%8ED%9A%8C%F32%A5%22%89B%92)%C5%25%D2%FFd%E2%DF%2C%FB%03%3E%DF5%00%B0j%3E%01%7B%91-%A8%5Dc%03%F6K'%10Xt%C0%E2%F7%00%00%F2%BBo%C1%D4(%08%03%80h%83%E1%CFw%FF%EF%3F%FDG%A0%25%00%80fI%92q%00%00%5ED%24.T%CA%B3%3F%C7%08%00%00D%A0%81*%B0A%1B%F4%C1%18%2C%C0%06%1C%C1%05%DC%C1%0B%FC%606%84B%24%C4%C2B%10B%0Ad%80%1Cr%60)%AC%82B(%86%CD%B0%1D*%60%2F%D4%40%1D4%C0Qh%86%93p%0E.%C2U%B8%0E%3Dp%0F%FAa%08%9E%C1(%BC%81%09%04A%C8%08%13a!%DA%88%01b%8AX%23%8E%08%17%99%85%F8!%C1H%04%12%8B%24%20%C9%88%14Q%22K%915H1R%8AT%20UH%1D%F2%3Dr%029%87%5CF%BA%91%3B%C8%002%82%FC%86%BCG1%94%81%B2Q%3D%D4%0C%B5C%B9%A87%1A%84F%A2%0B%D0dt1%9A%8F%16%A0%9B%D0r%B4%1A%3D%8C6%A1%E7%D0%ABh%0F%DA%8F%3EC%C70%C0%E8%18%073%C4l0.%C6%C3B%B18%2C%09%93c%CB%B1%22%AC%0C%AB%C6%1A%B0V%AC%03%BB%89%F5c%CF%B1w%04%12%81E%C0%096%04wB%20a%1EAHXLXN%D8H%A8%20%1C%244%11%DA%097%09%03%84Q%C2'%22%93%A8K%B4%26%BA%11%F9%C4%18b21%87XH%2C%23%D6%12%8F%13%2F%10%7B%88C%C47%24%12%89C2'%B9%90%02I%B1%A4T%D2%12%D2F%D2nR%23%E9%2C%A9%9B4H%1A%23%93%C9%DAdk%B2%079%94%2C%20%2B%C8%85%E4%9D%E4%C3%E43%E4%1B%E4!%F2%5B%0A%9Db%40q%A4%F8S%E2(R%CAjJ%19%E5%10%E54%E5%06e%982AU%A3%9AR%DD%A8%A1T%115%8FZB%AD%A1%B6R%AFQ%87%A8%134u%9A9%CD%83%16IK%A5%AD%A2%95%D3%1Ah%17h%F7i%AF%E8t%BA%11%DD%95%1EN%97%D0W%D2%CB%E9G%E8%97%E8%03%F4w%0C%0D%86%15%83%C7%88g(%19%9B%18%07%18g%19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00%00IEND%AEB%60%82";
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%14%00%00%00%14%08%06%00%00%00%8D%89%1D%0D%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%0AOiCCPPhotoshop%20ICC%20profile%00%00x%DA%9DSgTS%E9%16%3D%F7%DE%F4BK%88%80%94KoR%15%08%20RB%8B%80%14%91%26*!%09%10J%88!%A1%D9%15Q%C1%11EE%04%1B%C8%A0%88%03%8E%8E%80%8C%15Q%2C%0C%8A%0A%D8%07%E4!%A2%8E%83%A3%88%8A%CA%FB%E1%7B%A3k%D6%BC%F7%E6%CD%FE%B5%D7%3E%E7%AC%F3%9D%B3%CF%07%C0%08%0C%96H3Q5%80%0C%A9B%1E%11%E0%83%C7%C4%C6%E1%E4.%40%81%0A%24p%00%10%08%B3d!s%FD%23%01%00%F8~%3C%3C%2B%22%C0%07%BE%00%01x%D3%0B%08%00%C0M%9B%C00%1C%87%FF%0F%EAB%99%5C%01%80%84%01%C0t%918K%08%80%14%00%40z%8EB%A6%00%40F%01%80%9D%98%26S%00%A0%04%00%60%CBcb%E3%00P-%00%60'%7F%E6%D3%00%80%9D%F8%99%7B%01%00%5B%94!%15%01%A0%91%00%20%13e%88D%00h%3B%00%AC%CFV%8AE%00X0%00%14fK%C49%00%D8-%000IWfH%00%B0%B7%00%C0%CE%10%0B%B2%00%08%0C%000Q%88%85)%00%04%7B%00%60%C8%23%23x%00%84%99%00%14F%F2W%3C%F1%2B%AE%10%E7*%00%00x%99%B2%3C%B9%249E%81%5B%08-q%07WW.%1E(%CEI%17%2B%146a%02a%9A%40.%C2y%99%192%814%0F%E0%F3%CC%00%00%A0%91%15%11%E0%83%F3%FDx%CE%0E%AE%CE%CE6%8E%B6%0E_-%EA%BF%06%FF%22bb%E3%FE%E5%CF%ABp%40%00%00%E1t~%D1%FE%2C%2F%B3%1A%80%3B%06%80m%FE%A2%25%EE%04h%5E%0B%A0u%F7%8Bf%B2%0F%40%B5%00%A0%E9%DAW%F3p%F8~%3C%3CE%A1%90%B9%D9%D9%E5%E4%E4%D8J%C4B%5Ba%CAW%7D%FEg%C2_%C0W%FDl%F9~%3C%FC%F7%F5%E0%BE%E2%24%812%5D%81G%04%F8%E0%C2%CC%F4L%A5%1C%CF%92%09%84b%DC%E6%8FG%FC%B7%0B%FF%FC%1D%D3%22%C4Ib%B9X*%14%E3Q%12q%8ED%9A%8C%F32%A5%22%89B%92)%C5%25%D2%FFd%E2%DF%2C%FB%03%3E%DF5%00%B0j%3E%01%7B%91-%A8%5Dc%03%F6K'%10Xt%C0%E2%F7%00%00%F2%BBo%C1%D4(%08%03%80h%83%E1%CFw%FF%EF%3F%FDG%A0%25%00%80fI%92q%00%00%5ED%24.T%CA%B3%3F%C7%08%00%00D%A0%81*%B0A%1B%F4%C1%18%2C%C0%06%1C%C1%05%DC%C1%0B%FC%606%84B%24%C4%C2B%10B%0Ad%80%1Cr%60)%AC%82B(%86%CD%B0%1D*%60%2F%D4%40%1D4%C0Qh%86%93p%0E.%C2U%B8%0E%3Dp%0F%FAa%08%9E%C1(%BC%81%09%04A%C8%08%13a!%DA%88%01b%8AX%23%8E%08%17%99%85%F8!%C1H%04%12%8B%24%20%C9%88%14Q%22K%915H1R%8AT%20UH%1D%F2%3Dr%029%87%5CF%BA%91%3B%C8%002%82%FC%86%BCG1%94%81%B2Q%3D%D4%0C%B5C%B9%A87%1A%84F%A2%0B%D0dt1%9A%8F%16%A0%9B%D0r%B4%1A%3D%8C6%A1%E7%D0%ABh%0F%DA%8F%3EC%C70%C0%E8%18%073%C4l0.%C6%C3B%B18%2C%09%93c%CB%B1%22%AC%0C%AB%C6%1A%B0V%AC%03%BB%89%F5c%CF%B1w%04%12%81E%C0%096%04wB%20a%1EAHXLXN%D8H%A8%20%1C%244%11%DA%097%09%03%84Q%C2'%22%93%A8K%B4%26%BA%11%F9%C4%18b21%87XH%2C%23%D6%12%8F%13%2F%10%7B%88C%C47%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x%DA%AC%941n%C20%14%86%3F%BF%04h%A6J%CCp%91J%CC%1C%83%0A%05%8E%40%BB%B4%03S%CB%11%20%AD%60%EC%09*f%8ERfD'%20%C4q%17%07%A5i%02%89%CA7%C5%CA%FB%3F%3F%DB%89U%EF%E9%8D%1CZ%40%F76%AE%07%7B%A59%AA%18%80%9A%11%3C%E3%B0%95%D0%07%96%C0%3A%1B%94%CCX%01%03%CF%B8_%40%F0-!%07%A5%891%C4%18%0EJ%B3%95%10%20%00%3E%80%81%CD%E4%0A%9B%C0%0B0%DD%A9%88%12%DC%01S%9Bif%85%0Ax%00FTgd%B3*-%F4%F3d%F3q%9F%F9%B8_8%CEH%7D%00%17hy%C6%3D%BB%CC%02%C9%2F%3C%E3LwJ%7F%0A%D0-%B9gg%D9)%0D%D0%15%A0%C3%F5%E8H%1D%A7w-%5B%C38%3D%89%88%AF%D6%DEQ%C5%7F%3E%EC%7F%E3%BA%08!%BA%D2%89%A6k%EE%9F%DFO%CF5%04%09%D1%8Btq%BA%E0%12%D9%DA%03z!%C0%EARa%19%99e%25%C0%F2%06%97*%D2%BCw%D6%B1%14%60%BD'%1A%96%0D%16Md%1D%EB%E4%94%03%60rIz%A6%EB%89u%9C%D6j%80%D7%D4%8F%5EeO'6k%B2%F7%E1%06x%04%86%8D%9C%3D-%60h3%9B%A2%1B%DB%00%B3%03Q%3B%B9%8E%0A%F0%8160K%3AK%F8%19%00%D0%ADv%3B%DC%05%DB%11%00%00%00%00IEND%AEB%60%82";
    },

    addMediaImg : function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%18%00%00%00%18%08%06%00%00%00%E0w%3D%F8%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%0AOiCCPPhotoshop%20ICC%20profile%00%00x%DA%9DSgTS%E9%16%3D%F7%DE%F4BK%88%80%94KoR%15%08%20RB%8B%80%14%91%26*!%09%10J%88!%A1%D9%15Q%C1%11EE%04%1B%C8%A0%88%03%8E%8E%80%8C%15Q%2C%0C%8A%0A%D8%07%E4!%A2%8E%83%A3%88%8A%CA%FB%E1%7B%A3k%D6%BC%F7%E6%CD%FE%B5%D7%3E%E7%AC%F3%9D%B3%CF%07%C0%08%0C%96H3Q5%80%0C%A9B%1E%11%E0%83%C7%C4%C6%E1%E4.%40%81%0A%24p%00%10%08%B3d!s%FD%23%01%00%F8~%3C%3C%2B%22%C0%07%BE%00%01x%D3%0B%08%00%C0M%9B%C00%1C%87%FF%0F%EAB%99%5C%01%80%84%01%C0t%918K%08%80%14%00%40z%8EB%A6%00%40F%01%80%9D%98%26S%00%A0%04%00%60%CBcb%E3%00P-%00%60'%7F%E6%D3%00%80%9D%F8%99%7B%01%00%5B%94!%15%01%A0%91%00%20%13e%88D%00h%3B%00%AC%CFV%8AE%00X0%00%14fK%C49%00%D8-%000IWfH%00%B0%B7%00%C0%CE%10%0B%B2%00%08%0C%000Q%88%85)%00%04%7B%00%60%C8%23%23x%00%84%99%00%14F%F2W%3C%F1%2B%AE%10%E7*%00%00x%99%B2%3C%B9%249E%81%5B%08-q%07WW.%1E(%CEI%17%2B%146a%02a%9A%40.%C2y%99%192%814%0F%E0%F3%CC%00%00%A0%91%15%11%E0%83%F3%FDx%CE%0E%AE%CE%CE6%8E%B6%0E_-%EA%BF%06%FF%22bb%E3%FE%E5%CF%ABp%40%00%00%E1t~%D1%FE%2C%2F%B3%1A%80%3B%06%80m%FE%A2%25%EE%04h%5E%0B%A0u%F7%8Bf%B2%0F%40%B5%00%A0%E9%DAW%F3p%F8~%3C%3CE%A1%90%B9%D9%D9%E5%E4%E4%D8J%C4B%5Ba%CAW%7D%FEg%C2_%C0W%FDl%F9~%3C%FC%F7%F5%E0%BE%E2%24%812%5D%81G%04%F8%E0%C2%CC%F4L%A5%1C%CF%92%09%84b%DC%E6%8FG%FC%B7%0B%FF%FC%1D%D3%22%C4Ib%B9X*%14%E3Q%12q%8ED%9A%8C%F32%A5%22%89B%92)%C5%25%D2%FFd%E2%DF%2C%FB%03%3E%DF5%00%B0j%3E%01%7B%91-%A8%5Dc%03%F6K'%10Xt%C0%E2%F7%00%00%F2%BBo%C1%D4(%08%03%80h%83%E1%CFw%FF%EF%3F%FDG%A0%25%00%80fI%92q%00%00%5ED%24.T%CA%B3%3F%C7%08%00%00D%A0%81*%B0A%1B%F4%C1%18%2C%C0%06%1C%C1%05%DC%C1%0B%FC%606%84B%24%C4%C2B%10B%0Ad%80%1Cr%60)%AC%82B(%86%CD%B0%1D*%60%2F%D4%40%1D4%C0Qh%86%93p%0E.%C2U%B8%0E%3Dp%0F%FAa%08%9E%C1(%BC%81%09%04A%C8%08%13a!%DA%88%01b%8AX%23%8E%08%17%99%85%F8!%C1H%04%12%8B%24%20%C9%88%14Q%22K%915H1R%8AT%20UH%1D%F2%3Dr%029%87%5CF%BA%91%3B%C8%002%82%FC%86%BCG1%94%81%B2Q%3D%D4%0C%B5C%B9%A87%1A%84F%A2%0B%D0dt1%9A%8F%16%A0%9B%D0r%B4%1A%3D%8C6%A1%E7%D0%ABh%0F%DA%8F%3EC%C70%C0%E8%18%073%C4l0.%C6%C3B%B18%2C%09%93c%CB%B1%22%AC%0C%AB%C6%1A%B0V%AC%03%BB%89%F5c%CF%B1w%04%12%81E%C0%096%04wB%20a%1EAHXLXN%D8H%A8%20%1C%244%11%DA%097%09%03%84Q%C2'%22%93%A8K%B4%26%BA%11%F9%C4%18b21%87XH%2C%23%D6%12%8F%13%2F%10%7B%88C%C47%24%12%89C2'%B9%90%02I%B1%A4T%D2%12%D2F%D2nR%23%E9%2C%A9%9B4H%1A%23%93%C9%DAdk%B2%079%94%2C%20%2B%C8%85%E4%9D%E4%C3%E43%E4%1B%E4!%F2%5B%0A%9Db%40q%A4%F8S%E2(R%CAjJ%19%E5%10%E54%E5%06e%982AU%A3%9AR%DD%A8%A1T%115%8FZB%AD%A1%B6R%AFQ%87%A8%134u%9A9%CD%83%16IK%A5%AD%A2%95%D3%1Ah%17h%F7i%AF%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i%97%AB%03%D2%F1%3Bf%92A%CFK%8F%80%FE%12f%A3%60%16%C7%F1%5C%B7i%AE%D5%EA%E2%D4%BE%F0%C6%A9H%ADV%3F%0C%7C%19_b%3A%0A%95%AE%E0%F9%20x%0F%E9Q.%1B%5BX%5E%F3%C9%F4%2CXX%5E%93%CB%C6%DD%C0%CB%B8%1C0K%8Dm%DD%C1%878%15%24%B7%A7%8D%FFL%EC%F6%D2Z%B3%F1%F9lZ%3E%13%1F%E4%5C0%9A%EF%03%D6%9DV%3F(%E3%DB%60%16%0E%1AN%AD%5E%17%A7%8E%89S%B9n%0D%85%9D%00%FEA%C0*%1Ft%B4M%7C%1E%EE%7F%1E%C12%5B%E3.%3Em%B1%CC%CDn%9E%7C%1F_c%11%D7%0F1%7DX%0B%EB%16%F1%D5QM_X%F036%C2%B0%FC%A7%BF-%FF%0C%00i%15%F0%BD%C2%3DZ%BA%00%00%00%00IEND%AEB%60%82";
    },

    bookmarkAddImg : function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%0AOiCCPPhotoshop%20ICC%20profile%00%00x%DA%9DSgTS%E9%16%3D%F7%DE%F4BK%88%80%94KoR%15%08%20RB%8B%80%14%91%26*!%09%10J%88!%A1%D9%15Q%C1%11EE%04%1B%C8%A0%88%03%8E%8E%80%8C%15Q%2C%0C%8A%0A%D8%07%E4!%A2%8E%83%A3%88%8A%CA%FB%E1%7B%A3k%D6%BC%F7%E6%CD%FE%B5%D7%3E%E7%AC%F3%9D%B3%CF%07%C0%08%0C%96H3Q5%80%0C%A9B%1E%11%E0%83%C7%C4%C6%E1%E4.%40%81%0A%24p%00%10%08%B3d!s%FD%23%01%00%F8~%3C%3C%2B%22%C0%07%BE%00%01x%D3%0B%08%00%C0M%9B%C00%1C%87%FF%0F%EAB%99%5C%01%80%84%01%C0t%918K%08%80%14%00%40z%8EB%A6%00%40F%01%80%9D%98%26S%00%A0%04%00%60%CBcb%E3%00P-%00%60'%7F%E6%D3%00%80%9D%F8%99%7B%01%00%5B%94!%15%01%A0%91%00%20%13e%88D%00h%3B%00%AC%CFV%8AE%00X0%00%14fK%C49%00%D8-%000IWfH%00%B0%B7%00%C0%CE%10%0B%B2%00%08%0C%000Q%88%85)%00%04%7B%00%60%C8%23%23x%00%84%99%00%14F%F2W%3C%F1%2B%AE%10%E7*%00%00x%99%B2%3C%B9%249E%81%5B%08-q%07WW.%1E(%CEI%17%2B%146a%02a%9A%40.%C2y%99%192%814%0F%E0%F3%CC%00%00%A0%91%15%11%E0%83%F3%FDx%CE%0E%AE%CE%CE6%8E%B6%0E_-%EA%BF%06%FF%22bb%E3%FE%E5%CF%ABp%40%00%00%E1t~%D1%FE%2C%2F%B3%1A%80%3B%06%80m%FE%A2%25%EE%04h%5E%0B%A0u%F7%8Bf%B2%0F%40%B5%00%A0%E9%DAW%F3p%F8~%3C%3CE%A1%90%B9%D9%D9%E5%E4%E4%D8J%C4B%5Ba%CAW%7D%FEg%C2_%C0W%FDl%F9~%3C%FC%F7%F5%E0%BE%E2%24%812%5D%81G%04%F8%E0%C2%CC%F4L%A5%1C%CF%92%09%84b%DC%E6%8FG%FC%B7%0B%FF%FC%1D%D3%22%C4Ib%B9X*%14%E3Q%12q%8ED%9A%8C%F32%A5%22%89B%92)%C5%25%D2%FFd%E2%DF%2C%FB%03%3E%DF5%00%B0j%3E%01%7B%91-%A8%5Dc%03%F6K'%10Xt%C0%E2%F7%00%00%F2%BBo%C1%D4(%08%03%80h%83%E1%CFw%FF%EF%3F%FDG%A0%25%00%80fI%92q%00%00%5ED%24.T%CA%B3%3F%C7%08%00%00D%A0%81*%B0A%1B%F4%C1%18%2C%C0%06%1C%C1%05%DC%C1%0B%FC%606%84B%24%C4%C2B%10B%0Ad%80%1Cr%60)%AC%82B(%86%CD%B0%1D*%60%2F%D4%40%1D4%C0Qh%86%93p%0E.%C2U%B8%0E%3Dp%0F%FAa%08%9E%C1(%BC%81%09%04A%C8%08%13a!%DA%88%01b%8AX%23%8E%08%17%99%85%F8!%C1H%04%12%8B%24%20%C9%88%14Q%22K%915H1R%8AT%20UH%1D%F2%3Dr%029%87%5CF%BA%91%3B%C8%002%82%FC%86%BCG1%94%81%B2Q%3D%D4%0C%B5C%B9%A87%1A%84F%A2%0B%D0dt1%9A%8F%16%A0%9B%D0r%B4%1A%3D%8C6%A1%E7%D0%ABh%0F%DA%8F%3EC%C70%C0%E8%18%073%C4l0.%C6%C3B%B18%2C%09%93c%CB%B1%22%AC%0C%AB%C6%1A%B0V%AC%03%BB%89%F5c%CF%B1w%04%12%81E%C0%096%04wB%20a%1EAHXLXN%D8H%A8%20%1C%244%11%DA%097%09%03%84Q%C2'%22%93%A8K%B4%26%BA%11%F9%C4%18b21%87XH%2C%23%D6%12%8F%13%2F%10%7B%88C%C47%24%12%89C2'%B9%90%02I%B1%A4T%D2%12%D2F%D2nR%23%E9%2C%A9%9B4H%1A%23%93%C9%DAdk%B2%079%94%2C%20%2B%C8%85%E4%9D%E4%C3%E43%E4%1B%E4!%F2%5B%0A%9Db%40q%A4%F8S%E2(R%CAjJ%19%E5%10%E54%E5%06e%982AU%A3%9AR%DD%A8%A1T%115%8FZB%AD%A1%B6R%AFQ%87%A8%134u%9A9%CD%83%16IK%A5%AD%A2%95%D3%1Ah%17h%F7i%AF%E8t%BA%11%DD%95%1EN%97%D0W%D2%CB%E9G%E8%97%E8%03%F4w%0C%0D%86%15%83%C7%88g(%19%9B%18%07%18g%19w%18%AF%98L%A6%19%D3%8B%19%C7T071%EB%98%E7%99%0F%99oUX*%B6*%7C%15%91%CA%0A%95J%95%26%95%1B*%2FT%A9%AA%A6%AA%DE%AA%0BU%F3U%CBT%8F%A9%5ES%7D%AEFU3S%E3%A9%09%D4%96%ABU%AA%9DP%EBS%1BSg%A9%3B%A8%87%AAg%A8oT%3F%A4~Y%FD%89%06Y%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F%BD%02K%D3%04%055%BD%14%3A%409%CB%B2%A1_5%8CI%A1%E2%25%7D%04f%B2%EC%9F%07%97N%1C%EB%2B%BCxt%02%80%F7%DF%1B9%01%E1C%08~T%97Q%93%84%10%3ExIg%F3%B0%F6y%07%80%EA%C9%C9%BEs%BE%87%A4%19%2F%85%F4%7F%13%8C%F0%60%BA%24%E9OQ%8Cd1%F2ty%A5%97%AF%D5%B7Y%ABo%0Fd%3D%0F%14%02%00gNO%01%F0u%E7K%2F%CFG%9E)%04%DC%95%AB%F3%07ZG%7F%BD%3A%E7%00%CC%0C3K%AD%E4R3%A3dt%A3%E3%87%99%E1%9C%C3E%23%BA%7DS%A2%B3%BF%1B%F6%7B%00%A9%87%EE%B7%9A%3D%CD%99%00%00%00%00IEND%AEB%60%82";
    },
    bookmarkDelImg : function () {
        return "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%0AOiCCPPhotoshop%20ICC%20profile%00%00x%DA%9DSgTS%E9%16%3D%F7%DE%F4BK%88%80%94KoR%15%08%20RB%8B%80%14%91%26*!%09%10J%88!%A1%D9%15Q%C1%11EE%04%1B%C8%A0%88%03%8E%8E%80%8C%15Q%2C%0C%8A%0A%D8%07%E4!%A2%8E%83%A3%88%8A%CA%FB%E1%7B%A3k%D6%BC%F7%E6%CD%FE%B5%D7%3E%E7%AC%F3%9D%B3%CF%07%C0%08%0C%96H3Q5%80%0C%A9B%1E%11%E0%83%C7%C4%C6%E1%E4.%40%81%0A%24p%00%10%08%B3d!s%FD%23%01%00%F8~%3C%3C%2B%22%C0%07%BE%00%01x%D3%0B%08%00%C0M%9B%C00%1C%87%FF%0F%EAB%99%5C%01%80%84%01%C0t%918K%08%80%14%00%40z%8EB%A6%00%40F%01%80%9D%98%26S%00%A0%04%00%60%CBcb%E3%00P-%00%60'%7F%E6%D3%00%80%9D%F8%99%7B%01%00%5B%94!%15%01%A0%91%00%20%13e%88D%00h%3B%00%AC%CFV%8AE%00X0%00%14fK%C49%00%D8-%000IWfH%00%B0%B7%00%C0%CE%10%0B%B2%00%08%0C%000Q%88%85)%00%04%7B%00%60%C8%23%23x%00%84%99%00%14F%F2W%3C%F1%2B%AE%10%E7*%00%00x%99%B2%3C%B9%249E%81%5B%08-q%07WW.%1E(%CEI%17%2B%146a%02a%9A%40.%C2y%99%192%814%0F%E0%F3%CC%00%00%A0%91%15%11%E0%83%F3%FDx%CE%0E%AE%CE%CE6%8E%B6%0E_-%EA%BF%06%FF%22bb%E3%FE%E5%CF%ABp%40%00%00%E1t~%D1%FE%2C%2F%B3%1A%80%3B%06%80m%FE%A2%25%EE%04h%5E%0B%A0u%F7%8Bf%B2%0F%40%B5%00%A0%E9%DAW%F3p%F8~%3C%3CE%A1%90%B9%D9%D9%E5%E4%E4%D8J%C4B%5Ba%CAW%7D%FEg%C2_%C0W%FDl%F9~%3C%FC%F7%F5%E0%BE%E2%24%812%5D%81G%04%F8%E0%C2%CC%F4L%A5%1C%CF%92%09%84b%DC%E6%8FG%FC%B7%0B%FF%FC%1D%D3%22%C4Ib%B9X*%14%E3Q%12q%8ED%9A%8C%F32%A5%22%89B%92)%C5%25%D2%FFd%E2%DF%2C%FB%03%3E%DF5%00%B0j%3E%01%7B%91-%A8%5Dc%03%F6K'%10Xt%C0%E2%F7%00%00%F2%BBo%C1%D4(%08%03%80h%83%E1%CFw%FF%EF%3F%FDG%A0%25%00%80fI%92q%00%00%5ED%24.T%CA%B3%3F%C7%08%00%00D%A0%81*%B0A%1B%F4%C1%18%2C%C0%06%1C%C1%05%DC%C1%0B%FC%606%84B%24%C4%C2B%10B%0Ad%80%1Cr%60)%AC%82B(%86%CD%B0%1D*%60%2F%D4%40%1D4%C0Qh%86%93p%0E.%C2U%B8%0E%3Dp%0F%FAa%08%9E%C1(%BC%81%09%04A%C8%08%13a!%DA%88%01b%8AX%23%8E%08%17%99%85%F8!%C1H%04%12%8B%24%20%C9%88%14Q%22K%915H1R%8AT%20UH%1D%F2%3Dr%029%87%5CF%BA%91%3B%C8%002%82%FC%86%BCG1%94%81%B2Q%3D%D4%0C%B5C%B9%A87%1A%84F%A2%0B%D0dt1%9A%8F%16%A0%9B%D0r%B4%1A%3D%8C6%A1%E7%D0%ABh%0F%DA%8F%3EC%C70%C0%E8%18%073%C4l0.%C6%C3B%B18%2C%09%93c%CB%B1%22%AC%0C%AB%C6%1A%B0V%AC%03%BB%89%F5c%CF%B1w%04%12%81E%C0%096%04wB%20a%1EAHXLXN%D8H%A8%20%1C%244%11%DA%097%09%03%84Q%C2'%22%93%A8K%B4%26%BA%11%F9%C4%18b21%87XH%2C%23%D6%12%8F%13%2F%10%7B%88C%C47%24%12%89C2'%B9%90%02I%B1%A4T%D2%12%D2F%D2nR%23%E9%2C%A9%9B4H%1A%23%93%C9%DAdk%B2%079%94%2C%20%2B%C8%85%E4%9D%E4%C3%E43%E4%1B%E4!%F2%5B%0A%9Db%40q%A4%F8S%E2(R%CAjJ%19%E5%10%E54%E5%06e%982AU%A3%9AR%DD%A8%A1T%115%8FZB%AD%A1%B6R%AFQ%87%A8%134u%9A9%CD%83%16IK%A5%AD%A2%95%D3%1Ah%17h%F7i%AF%E8t%BA%11%DD%95%1EN%97%D0W%D2%CB%E9G%E8%97%E8%03%F4w%0C%0D%86%15%83%C7%88g(%19%9B%18%07%18g%19w%18%AF%98L%A6%19%D3%8B%19%C7T071%EB%98%E7%99%0F%99oUX*%B6*%7C%15%91%CA%0A%95J%95%26%95%1B*%2FT%A9%AA%A6%AA%DE%AA%0BU%F3U%CBT%8F%A9%5ES%7D%AEFU3S%E3%A9%09%D4%96%ABU%AA%9DP%EBS%1BSg%A9%3B%A8%87%AAg%A8oT%3F%A4~Y%FD%89%06Y%C3L%C3OC%A4Q%A0%B1_%E3%BC%C6%20%0Bc%19%B3x%2C!k%0D%AB%86u%815%C4%26%B1%CD%D9%7Cv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A0%F3%D1%DCG%F7%06%85%83%CF%FE%91%F5%8F%0FC%05%8F%99%8F%CB%86%0D%86%EB%9E8%3E99%E2%3Fr%FD%E9%FC%A7C%CFd%CF%26%9E%17%FE%A2%FE%CB%AE%17%16%2F~%F8%D5%EB%D7%CE%D1%98%D1%A1%97%F2%97%93%BFm%7C%A5%FD%EA%C0%EB%19%AF%DB%C6%C2%C6%1E%BE%C9x31%5E%F4V%FB%ED%C1w%DCw%1D%EF%A3%DF%0FO%E4%7C%20%7F(%FFh%F9%B1%F5S%D0%A7%FB%93%19%93%93%FF%04%03%98%F3%FCc3-%DB%00%00%00%20cHRM%00%00z%25%00%00%80%83%00%00%F9%FF%00%00%80%E9%00%00u0%00%00%EA%60%00%00%3A%98%00%00%17o%92_%C5F%00%00%01%7CIDATx%DA%A4%93%3DOTA%14%86%9F%D9%CC%5E%E0F%12%8Bm%04%13CAbC%C3%87%1ACEC%85%89%AD%0D%89%92P%F2%07%2C%FD%03v%40%C0P%5BXHEae%25%1FV%26%1Ajm%14%0D%EC%26x%DE%DD%BDs%2C%94%05%EE%AE%C9%12N2%C9I%DE%99w%DEy%26'%B8%3B%D7%A9%B8%BB%B7%EF%7B%FB%1F%7F%FFG%1F%9A%99%9E%E4%ED%DAjpw%82%C3%8BW%9B%97%0D%3E%EC%1E%9C.%3C~%92g%D9%40%D7%E9fS%BCy%BD%F5%F5%2C%A5%07x%FE%F4%19%90j%EE%E1%08%12Q%B2%CFY60%F5%AB%DE%EA2%18%CE%AB%C8%EC%F0%C6%F8%DDw%25i%0E%60v%F6!%B1%D1%A8%BF%07%A6%AC%99%BA%0C%AA1%B0%B8%B42%D7%EBm%92%B1%B5%F1%F2%5B%94%B4%0C%A0V7L%9D%B49%3Ai%F7%843vk%10I%8D(%D3%D0H-%E3f%DE%BE%12%FD%3C%CF%90%A9%1E%25k%01%D5%A2(%AE%FC%85%92%D5%A2%A4%2F%C0DQ%9C38%9D%9F%EF%7D%EB%CEN%C9%40D3%8B%00%FD%24(%EF1%B3OQ%D2%9D%B2%18%B7%B7%FB2%904%11%25%CB%FBM%D0%83%C1XE%D2_%F7%94(Rb%7Dc%B3%D3%97%D7E%AD%C3%40f%00%DC%1E%1D%01%E0%E7%8F%EF%9D%BE%5CeMf%84%7B%F7%1F%5Ck%1C%E3%A3%99%E9%00%E0%EE%B8%7B%EE%95%90%BB%3B%15%A7%9D%02%C7%EEN%08%81%90%9C%14%CEh%A6%E0%FF%26%EC%CF%00%99%1D%E3%1E%F9%E5%7C%90%00%00%00%00IEND%AEB%60%82";
    },
    //horizontalRepeater: function() {
    //    return "data:image/gif,GIF89a%01%00%04%00%87%00%00%5C%5C%5C%A5%AC%B2%C6%C6%C6%DD%DD%DD%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%00%00%00%FF%00%2C%00%00%00%00%01%00%04%00%00%08%07%00%03%0C%10%00%20%20%00%3B";
    //},
    //verticalRepeater: function() {
    //    return "data:image/gif,GIF89a%04%00%01%00%87%00%00%84%84%84%AE%B5%B9%C6%C6%C6%D2%D2%D2%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%03%00%00%04%00%2C%00%00%00%00%04%00%01%00%00%08%07%00%03%0C%10%00%20%20%00%3B";
    //},
    IMImg : function () {
        return"%3D%3D";
    }

};

MigScript.UI.Dialog = {
    getDialog: function (title, noCancel) {
        var el = MigScript.DomUtil.ge("dlg_txt");
        if (el == null) {
            el = MigScript.DomUtil.dc("div");
            el.id = "dlg_txt";
            el.className = "popup_box_container message_box";
            el.style.width = "410px";
            el.style.position = "fixed";
            //el.style.top = document.documentElement.scrollTop + 100 + "px";
            el.style.top = "50px";
            el.style.marginLeft = "-215px";
            el.style.zIndex = "2000";
            document.body.appendChild(el);

            var div0 = MigScript.DomUtil.dc("div");
            div0.className = "box_layout";
            el.appendChild(div0);

            var div1 = MigScript.DomUtil.dc("div");
            div1.className = "box_title_wrap";
            div1.innerHTML = "<div class=\"box_title\">" + title + "</div>";
            div0.appendChild(div1);

            var div2 = MigScript.DomUtil.dc("div");
            div2.className = "box_body";
            div2.id = "dlg_body";
            div0.appendChild(div2);

            var div3 = MigScript.DomUtil.dc("div");
            div3.className = "box_controls";
            div3.id = "dlg_controls";
            div0.appendChild(div3);

            var div4 = MigScript.DomUtil.dc("div");
            div4.id = "dlg_c_btn";
            div4.className = "button_wrap button_no";
            div3.appendChild(div4);

            var div5 = MigScript.DomUtil.dc("div");
            div5.id = "dlg_ok_btn";
            div5.className = "button_wrap button_yes";
            div3.appendChild(div5);

            if (!noCancel) {
                var div6 = MigScript.DomUtil.dc("div");
                div6.className = "box_button";
                div6.innerHTML = "Отмена/Закрыть";
                div6.addEventListener("click", function() {
                    MigScript.UI.Dialog.destroyDlg();
                }, false);
                div4.appendChild(div6);
            }
        }
        return el;
    },


    showTxt : function (txt) {
        MigScript.UI.Dialog.getDialog().style.display = "block";
        MigScript.DomUtil.removeChildNodes(MigScript.DomUtil.ge("dlg_body"));
        var text = document.createTextNode(txt);
        MigScript.DomUtil.ge("dlg_body").appendChild(text);
    },

    showBlock : function (obj) {
        MigScript.UI.Dialog.getDialog().style.display = "block";
        MigScript.DomUtil.ge("dlg_body").innerHTML = obj;
    },

    showImg : function (img, label) {
        MigScript.UI.Dialog.getDialog().style.display = "inherit";
        var div = MigScript.DomUtil.ge("dlg_body");
        MigScript.DomUtil.removeChildNodes(div);
        div.appendChild(img);
        if (label != null) {
            var text = document.createTextNode(label);
            var c = MigScript.DomUtil.dc("center");
            c.appendChild(text);
            div.appendChild(c);
        }

    },

    destroyDlg : function () {
        MigScript.DomUtil.hide("container");
        var el = MigScript.DomUtil.ge("container");
        if (el != null) {
            MigScript.DomUtil.removeChildNodes(el);
        }
        MigScript.DomUtil.hide("dlg_txt");
        el = MigScript.DomUtil.ge("dlg_txt");
        if (el != null) {
            MigScript.DomUtil.removeChildNodes(el);
            el.parentNode.removeChild(el);
        }
        MigScript.DomUtil.hide("hider");
        MigScript.DomUtil.removeChildNodes(MigScript.DomUtil.ge("hider"));
    }


};

MigScript.UI.Settings = {
    openSettings: function () {

        //	MigScript.DomUtil.removeChildNodes(MigScript.DomUtil.ge("pageBody"));
        MigScript.DomUtil.removeChildNodes(MigScript.DomUtil.ge("pageBody"));
        MigScript.DomUtil.appendDiv("pageBody", "wrapH");
        MigScript.DomUtil.appendDiv("wrapH", "wrapHI");
        var h = MigScript.DomUtil.appendDiv("wrapHI", "header");
        h.innerHTML = "<h1> Настройки Mig[vk]Script</h1>";
        //var d = MigScript.DomUtil.appendDiv("wrapHI", "settKillDiv");
        var killA = MigScript.DomUtil.dc("a");
        killA.style.cursor = "pointer";
        killA.innerHTML = "[Полностью очистить настройки]";
        killA.addEventListener("click", function() {
            MigScript.Settings.purgeSettings();
        }, false);
        h.appendChild(killA);

        var killAl = MigScript.DomUtil.dc("a");
        killAl.style.cursor = "pointer";
        killAl.innerHTML = "[Сбросить оповещения]";
        killAl.addEventListener("click", function() {
            MigScript.UI.killAlerts();
        }, false);
        h.appendChild(killAl);

        MigScript.DomUtil.appendDiv("pageBody", "wrap2");
        MigScript.DomUtil.appendDiv("wrap2", "wrap1");
        var config_cont = MigScript.DomUtil.appendDiv("wrap1", "content");
        config_cont.className = "editorPanel clearFix";

        var c = MigScript.DomUtil.dc("center");

        var sett_table = MigScript.DomUtil.dc("table");
        sett_table.id = "s_table";
        c.appendChild(sett_table);
        config_cont.appendChild(c);
        try {
            //            MigScript.Settings.getSortedSettings(MigScript.Settings.loadSettings());
            for (var i = 0; i < MigScript.Settings.tsettings.length; i++) {
                var row = MigScript.DomUtil.dc("tr");
                var td0 = MigScript.DomUtil.dc("td");
                td0.className = "td0";
                sett_table.appendChild(row);
                row.appendChild(td0);
                if (MigScript.Settings.tsettings[i].text) {
                    var el = document.createTextNode(MigScript.Settings.tsettings[i].text);
                    td0.appendChild(el);

                }
                var td1 = MigScript.DomUtil.dc("td");
                td1.className = "td1";
                row.appendChild(td1);
                if (MigScript.Settings.tsettings[i].type == "alink") {
                    var b = MigScript.DomUtil.dc("b");
                    td1.appendChild(b);
                    var a = MigScript.DomUtil.dc("a");
                    a.setAttribute("_id", i);
                    a.href = "#_";
                    a.id = MigScript.Settings.tsettings[i].id;
                    a.addEventListener("click", function() {
                        MigScript.Settings.tsettings[this.getAttribute("_id")].action();
                    }, true);
                    a.style.color = "#aaaa00";
                    a.title = MigScript.Settings.tsettings[i].title;
                    if (MigScript.Settings.tsettings[i].value != null && MigScript.Settings.tsettings[i].value != "") {
                        a.appendChild(document.createTextNode(MigScript.Settings.tsettings[i].value));
                    }
                    else {
                        a.appendChild(document.createTextNode(MigScript.Settings.tsettings[i].defaultValue));
                    }
                    b.appendChild(a);
                    MigScript.Settings.tsettings[i].condition();
                } else if (MigScript.Settings.tsettings[i].type == "area") {
                    var ar = MigScript.DomUtil.dc("textarea");
                    td1.appendChild(ar);
                    td1.style.width = "300px";
                    ar.style.width = "300px";
                    ar.style.height = "200px";
                    ar.id = MigScript.Settings.tsettings[i].id;
                    ar.value = MigScript.Settings.tsettings[i].value;
                }
                else if (MigScript.Settings.tsettings[i].type == "text") {
                        var font = MigScript.DomUtil.dc("font");
                        font.color = "#aaaa00";
                        font.style.marginLeft = "50px";
                        td1.appendChild(font);
                        font.appendChild(document.createTextNode(MigScript.Settings.tsettings[i].value));
                    } else
                        if (MigScript.Settings.tsettings[i].type == "input") {
                            var input = MigScript.DomUtil.dc("input");
                            input.type = "text";
                            input.value = MigScript.Settings.tsettings[i].value;
                            input.className = "config_input";
                            input.id = MigScript.Settings.tsettings[i].id;
                            td1.appendChild(input);
                        } else
                            if (MigScript.Settings.tsettings[i].type == "checkbox") {
                                var chk = new MigScript.CustomObjects.CheckboxClass(MigScript.Settings.tsettings[i].id, MigScript.Settings.tsettings[i].value);
                                chk.body.style.marginLeft = "50px";
                                chk.body.style.width = "16px";
                                chk.body.style.height = "16px";
                                chk.body.style.position = "relative";
                                chk.body.style.top = "2px";
                                td1.appendChild(chk.body);
                            } else if (MigScript.Settings.tsettings[i].type == "section") {
                                var d1 = MigScript.DomUtil.dc("div");
                                var d2 = MigScript.DomUtil.dc("div");
                                var d3 = MigScript.DomUtil.dc("div");
                                d1.style.display = "inline";
                                d2.style.display = "inline";
                                d2.style.width = "300px";
                                d3.style.display = "inline";
                                var c1 = MigScript.DomUtil.dc("center");
                                MigScript.DomUtil.removeChildNodes(row);
                                td0 = MigScript.DomUtil.dc("td");
                                td0.colSpan = "2";
                                row.appendChild(td0);
                                td0.appendChild(c1);
                                c1.appendChild(d1);
                                c1.appendChild(d2);
                                c1.appendChild(d3);
                                var hr = MigScript.DomUtil.dc("hr");
                                d1.appendChild(hr);

                                hr = MigScript.DomUtil.dc("hr");
                                d3.appendChild(hr);
                                var b1 = MigScript.DomUtil.dc("b");
                                d2.appendChild(b1);
                                b1.appendChild(document.createTextNode(MigScript.Settings.tsettings[i].label));
                            }
                /*else
                 if (MigScript.Settings.tsettings[i].type == "drop") {
                 var sel = MigScript.DomUtil.dc("select");
                 sel.multiple = "";
                 sel.size = "5";
                 sel.id = MigScript.Settings.tsettings[i].id;
                 sel.value = MigScript.Settings.tsettings[i].value;
                 sel.style.backgroundColor = "#ffcc00";
                 var _id = MigScript.Settings.tsettings[i].id;
                 MigScript.Settings.tsettings[i].source(_id);
                 td1.appendChild(sel);
                 }*/
            }
            var br = MigScript.DomUtil.dc("br");
            config_cont.appendChild(br);
            br = MigScript.DomUtil.dc("br");
            config_cont.appendChild(br);


            config_cont.appendChild(MigScript.UI.createVkBtnSet());

            MigScript.UI.addVkBtn("Сохранить настройки", "150px", function() {
                MigScript.Settings.saveSettings();
            });
        } finally {
            MigScript.UI.addVkBtn("Сбросить по умолчанию", "150px", function() {
                MigScript.Settings.resetSettings();
            });
            config_cont.appendChild(MigScript.DomUtil.dc("br"));
        }
    }

};

MigScript.UI.MainMenu = {
    menuFloater : null,
    isOpen : false,
    resetMenu : function() {
        var mask = MigScript.Settings.local_settings[38].split("|");
        if (MigScript.Settings.local_settings[37]) {
            var menu = MigScript.DomUtil.ge("nav").getElementsByTagName("a");
            for (var i = 0; i < menu.length; i++) {

                var els = menu[i].innerHTML.split(" ");
                if (els[1] || (els[1] && els[2]))
                {
                    if (!els[1].match(/\(<b>\d+<\/b>\)/) && checkMask(els[0])) {
                        menu[i].innerHTML = els[1];
                    }
                }


            }
        }

        function checkMask(arg) {
            for (var i = 0; i < mask.length; i++) {
                if (arg == mask[i]) {
                    return true;
                }
            }
            return false;
        }

        ;


    },
    extendMenu  : function() {
        var addCont = function(el, prefix) {
            el.addEventListener("mouseover", function() {
                //MigScript.DomUtil.ge(prefix + "_ext").style.marginLeft = "10px";
                MigScript.DomUtil.toggle(MigScript.DomUtil.ge(prefix + "_ext"));
            }, false);
            el.addEventListener("mouseout", function() {
                var timer = setTimeout(function() {
                    MigScript.DomUtil.hide(prefix + "_ext");
                }, MigScript.Settings.local_settings[4]);
                MigScript.DomUtil.ge(prefix + "_ext").setAttribute("timer", uneval(timer));
            }, false);

            var d = MigScript.DomUtil.dc("div");
            d.style.display = "none";
            d.id = prefix + "_ext";
            d.style.backgroundColor = "rgba(255,255,255,0.6)";
            d.style.zIndex = "5000";
            d.addEventListener("mouseover", function() {
                clearTimeout(eval(this.getAttribute("timer")));
                MigScript.DomUtil.show(prefix + "_ext");
            }, false);
            el.parentNode.appendChild(d);
            if (MigScript.Settings.local_settings[32]) {
                d.style.position = "absolute";
                d.style.marginTop = "-20px";
                d.style.marginLeft = d.parentNode.offsetWidth - 5 + "px";
                d.style.zIndex = "50000";
                d.style.borderTop = "1px solid #B1BDD6";
                d.style.borderRight = "1px solid #B1BDD6";
                d.style.borderBottom = "1px solid #B1BDD6";
                d.addEventListener("mouseout", function() {
                    var timer = setTimeout(function() {
                        MigScript.DomUtil.hide(prefix + "_ext");
                    }, MigScript.Settings.local_settings[4]);
                    MigScript.DomUtil.ge(prefix + "_ext").setAttribute("timer", uneval(timer));
                }, false);
            }
        };
        var addBtn = function(prefix, label, href) {
            var a = MigScript.DomUtil.dc("a");
            a.style.setProperty("color", "#666", "important");
            a.style.cursor = "pointer";
            a.innerHTML = "&nbsp;&nbsp;&nbsp;" + label;
            if (href) {
                a.href = MigScript.HOST + href;
            }
            MigScript.DomUtil.ge(prefix + "_ext").appendChild(a);
            return a;
        };


        if (MigScript.Settings.local_settings[19]) {
            var menu = MigScript.DomUtil.ge("sideBar").getElementsByTagName("ol")[0].getElementsByTagName("a");
            //Косметика
            var edit = MigScript.DomUtil.geByClass("edit", MigScript.DomUtil.ge("myprofile"), "a")[0];
            edit.parentNode.removeChild(edit);
            var ll = MigScript.DomUtil.geByClass("hasedit", MigScript.DomUtil.ge("myprofile"), "a")[0];
            ll.style.padding = "3px 3px 3px 6px";
            ll.className = "";


            for (var i = 0; i < menu.length; i++) {
                // Добавляем дополнительные кнопки
                if (menu[i].href == MigScript.HOST + "/newsfeed.php") {
                    addCont(menu[i], "news");
                    addBtn("news", "Группы", "/newsfeed.php?section=groups");
                    addBtn("news", "Комментарии", "/newsfeed.php?section=comments");
                }
                if (menu[i].href == MigScript.HOST + "/friends.php") {
                    addCont(menu[i], "friends");
                    addBtn("friends", "Избранные").addEventListener("click", function(e) {
                        MigScript.UI.FavContainer.openFavContainer(e);
                        MigScript.UI.FavContainer.addFriends();
                    }, true);
                }

                if (menu[i].href == MigScript.HOST + "/audio.php") {
                    addCont(menu[i], "audio");
                    addBtn("audio", "Залить", "/audio.php?act=new");
                    addBtn("audio", "Редактировать", "/audio.php?act=edit");
                }
                if (menu[i].href == MigScript.HOST + "/groups.php") {
                    addCont(menu[i], "groups");
                    addBtn("groups", "Избранные").addEventListener("click", function(e) {
                        MigScript.UI.FavContainer.openGrContainer(e);
                        MigScript.UI.FavContainer.addGroups();
                    }, true);
                }
                if (menu[i].href == MigScript.HOST + "/mail.php?id=" + MigScript.myUid) {
                    addCont(menu[i], "mail");
                    addBtn("mail", "Исходящие", "/mail.php?out=1");
                    addBtn("mail", "Написать", "/mail.php?act=write");

                }
                if (menu[i].href == MigScript.HOST + "/notes.php") {
                    addCont(menu[i], "notes");
                    addBtn("notes", "Написать", "/notes.php?act=new");
                    addBtn("notes", "Комментарии", "/notes.php?act=comms");
                }
                if (menu[i].href == MigScript.HOST + "/events.php") {
                    addCont(menu[i], "events");
                    addBtn("events", "Календарь", "/events.php?act=calendar");
                }
                if (menu[i].href == MigScript.HOST + "/photos.php") {
                    addCont(menu[i], "photos");
                    addBtn("photos", "Новый&nbsp;альбом", "/photos.php?act=new");
                    addBtn("photos", "Обзор", "/photos.php?act=albums");
                    addBtn("photos", "Комментарии", "/photos.php?act=comments");
                    addBtn("photos", "Фото&nbsp;с&nbsp;вами", "/photos.php?act=user&id=" + MigScript.myUid);

                }
                if (menu[i].href == MigScript.HOST + "/video.php") {
                    addCont(menu[i], "video");
                    addBtn("video", "Загрузить", "/video.php?act=new");
                    addBtn("video", "Комментарии", "/video.php?act=comments&id=" + MigScript.myUid);
                }

                if (menu[i].href == MigScript.HOST + "/fave.php") {
                    addCont(menu[i], "fave");
                    addBtn("fave", "Кто&nbsp;\"заложил\"").addEventListener("click", function(e) {
                        MigScript.UI.WhoFaved.open(e);
                    }, true);
                }
                if (menu[i].href == MigScript.HOST + "/id" + MigScript.myUid) {
                    addCont(menu[i], "person");
                    addBtn("person", "Стена", "/wall.php").style.padding = "3px 3px 3px 6px";
                    addBtn("person", "Редактировать", "/editProfile.php?act=general").style.padding = "3px 3px 3px 6px";
                }


                if (menu[i].id == "sett_link") {
                    addCont(menu[i], "sett");
                    addBtn("sett", "Обновить").addEventListener("click", function() {
                        MigScript.Update.forceUpd();
                    }, true);
                    addBtn("sett", "Убрать&nbsp;оповещения").addEventListener("click", function() {
                        MigScript.UI.killAlerts();
                    }, true);

                    addBtn("sett", "Группа&nbsp;Mig[VK]Script", "/club12388587").target = "_blank";
                    addBtn("sett", "Новое оповещение").addEventListener("click", function() {
                        MigScript.alert("Инициировано", "Новое оповещение", "message");
                    }, true);
                }

            }
        }
    },
    addUnfix : function() {
        var unfixBtn = MigScript.DomUtil.dc("a");
        unfixBtn.innerHTML = "^Отцепить^";
        unfixBtn.id = "menuUnfix";
        unfixBtn.style.fontSize = "6pt";
        unfixBtn.style.cursor = "pointer";
        unfixBtn.addEventListener("click", function() {
            MigScript.UI.MainMenu.wrapMenu();
            MigScript.UI.MainMenu.delUnfix();
            MigScript.UI.MainMenu.isOpen = true;
            MigScript.Util.serialize("mainMenu_open", MigScript.UI.MainMenu.isOpen);
        }, false);
        MigScript.DomUtil.ge("nav").insertBefore(unfixBtn, MigScript.DomUtil.ge("myprofile"));
    },
    delUnfix : function() {
        var btn = MigScript.DomUtil.ge("menuUnfix");
        if (btn) {
            btn.parentNode.removeChild(btn);
        }
    },
    wrapMenu : function() {
        var x,y;
        x = MigScript.Util.deserialize("mainMenu_x", 30);
        y = MigScript.Util.deserialize("mainMenu_y", 30);
        MigScript.UI.MainMenu.menuFloater = new MigScript.CustomObjects.FloaterClass(x, y, "mainMenu", "Меню", {minWidth:125, minHeight: 45, width: MigScript.Util.deserialize("mainMenu_W", 0) ,height:MigScript.Util.deserialize("mainMenu_H", MigScript.DomUtil.ge("sideBar").offsetHeight)});
        //MigScript.UI.MainMenu.menuFloater.cont.removeChild(MigScript.UI.MainMenu.menuFloater.body);
        MigScript.UI.MainMenu.menuFloater.cont.removeChild(MigScript.UI.MainMenu.menuFloater.txt);
        //MigScript.UI.MainMenu.menuFloater.body = MigScript.DomUtil.ge("sideBar");
        MigScript.UI.MainMenu.menuFloater.body.appendChild(MigScript.DomUtil.ge("sideBar"));
        if (MigScript.Settings.local_settings[22]) {
            GM_addStyle("#Information .people_table{width:100%;}#my_audios .audioRow{width:500px;}#videocomment{width:520px;}#videoinfo{width:720px;} #photocomment{width:520px;}.comment .body .justComment, .comment .bigbody .justComment{width:450px;}.comment .body, .comment .bigbody {width:520px;}#photoinfo{width:720px;}.audioRow {width:520px;}#startagroup{width:300px;}.groupslist .info{width:500px;} .groupslist .grouprow{width:723px;}.commentHead{float:none;}.note .note_body{width: 490px;}.inbox {width:755px!important;}.mainPanel{width:575px;} .results{width:725px;} #pageBody{width:760px;}#fave #leftColumn{width:515px;}#fave #rightColumn{width:210px;} #rightColumn{width:525px;} .dataWrap{width:400px;}  #group.profile .right{width:200px; margin-left:24px;} #group.profile .left{width:500px;}");
        }
        MigScript.UI.MainMenu.menuFloater.onClose = function() {
            //  MigScript.DomUtil.ge("sideBar").parentNode.removeChild(MigScript.DomUtil.ge("sideBar"));
            try {
                MigScript.DomUtil.insertAfter("sideBar", "pageHeader");
            } catch(e) {
                MigScript.DomUtil.insertAfter("sideBar", "pageHeader1");
            }
            MigScript.UI.MainMenu.addUnfix();
            if (MigScript.Settings.local_settings[22]) {
                GM_addStyle("#my_audios .audioRow{width:450px;} #videocomment{width:400px;}#videoinfo{width:606px;}#photocomment{width:400px;}.comment .body .justComment, .comment .bigbody .justComment{width:345px;}.comment .body, .comment .bigbody {width:400px;}#photoinfo{width:606px;}.audioRow {width:450px;}#startagroup{width:200px;}.groupslist .info{width:364px;} .groupslist .grouprow{width:594px;}.commentHead{float:left;}.note .note_body{width: 370px;}.inbox {width:auto!important;}.mainPanel{width:451px;} .results{width:606px;}#pageBody{width:632px;}#fave #leftColumn{width:398px;}  #rightColumn{width:396px;} .dataWrap{width:260px;}  #group.profile .right{width:200px; margin-left:0px;} #group.profile .left{width:396px;}");
            }
            MigScript.UI.MainMenu.isOpen = false;
            MigScript.Util.serialize("mainMenu_open", MigScript.UI.MainMenu.isOpen);
        };
        MigScript.DomUtil.ge("sideBar").style.margin = "0";
        MigScript.DomUtil.ge("sideBar").style.setProperty("width", "auto", "important");
        MigScript.DomUtil.ge("sideBar").style.minWidth = "118px";
        MigScript.UI.MainMenu.menuFloater.body.style.overflow = "hidden";
        // MigScript.UI.MainMenu.menuFloater.cont.appendChild(MigScript.DomUtil.ge("sideBar"));
        //MigScript.DomUtil.ge("sideBar").parentNode.removeChild(MigScript.DomUtil.ge("sideBar"));
    },
    init: function() {
        MigScript.UI.MainMenu.isOpen = MigScript.Util.deserialize("mainMenu_open", "false");
        if (MigScript.Settings.local_settings[21]) {
            if (MigScript.UI.MainMenu.isOpen) {
                MigScript.UI.MainMenu.wrapMenu();
            } else {
                MigScript.UI.MainMenu.addUnfix();
            }
        }
    }
};

MigScript.UI.Menu = {
    addMenu : function (elem, menuId) {
        elem.addEventListener("mouseover", function(e) {
            e.stopPropagation();
            MigScript.UI.Menu.showMenu(menuId, elem, e);
        }, true);
        elem.addEventListener("mouseout", function(e) {
            e.stopPropagation();
            MigScript.UI.Menu.hideMenu("menu_" + menuId);
        }, true);
    },

    getMenu : function (menuId) {
        var menu = MigScript.DomUtil.ge("menu_" + menuId);
        if (menu == null) {
            menu = MigScript.UI.Menu.createMenu(menuId);
        }
        return menu;
    },

    createMenu : function (menuId) {
        var menu = MigScript.DomUtil.dc("div");
        menu.id = "menu_" + menuId;
        menu.className = "menu_cont";
        var isFr = MigScript.Friends.isFriend(menuId);
        var fav = MigScript.Friends.isFavFriend(menuId);
        for (var i = 0; i < MigScript.Menu.menuAttrs.length; i++) {
            if (MigScript.Menu.menuAttrs[i].forFriend == null || (MigScript.Menu.menuAttrs[i].forFriend && isFr) || (!MigScript.Menu.menuAttrs[i].forFriend && !isFr)) {
                if (((MigScript.Menu.menuAttrs[i].hasOwnProperty("forFav")) && ((MigScript.Menu.menuAttrs[i].forFav && fav) || (!MigScript.Menu.menuAttrs[i].forFav && !fav))) || (!MigScript.Menu.menuAttrs[i].hasOwnProperty("forFav"))) {
                    var img = MigScript.DomUtil.dc("img");
                    img.alt = MigScript.Menu.menuAttrs[i].label;
                    img.title = MigScript.Menu.menuAttrs[i].label;
                    img.src = MigScript.Menu.menuAttrs[i].img;
                    img.className = "menu_button";
                    img.setAttribute("_id", i);
                    if (MigScript.Menu.menuAttrs[i].action != null) {
                        MigScript.Menu.imgActions[i] = MigScript.Menu.menuAttrs[i].action;
                        //doll = function(){action(menuId)};
                        img.addEventListener("click", function(e) {
                            MigScript.Menu.imgActions[this.getAttribute("_id")](menuId, e);
                        }, true);
                        menu.appendChild(img);
                        img.style.cursor = "pointer";
                    }
                    if (MigScript.Menu.menuAttrs[i].url != null) {
                        var link = MigScript.DomUtil.dc("a");
                        link.href = MigScript.Menu.menuAttrs[i].url + menuId;
                        link.appendChild(img);
                        menu.appendChild(link);
                    }
                }
            }
        }
        menu.addEventListener("mouseout", function(e) {
            e.stopPropagation();
            MigScript.UI.Menu.hideMenu(this.id);
        }, true);
        menu.addEventListener("mouseover", function(e) {
            e.stopPropagation();
            MigScript.UI.Menu.showMenu(this.id.match(/\d+/));
        }, true);
        return menu;
    },

    showMenu : function(menuId, elem, event) {
        var menu = MigScript.UI.Menu.getMenu(menuId);
        clearTimeout(eval(menu.getAttribute("timer")));
        menu.style.display = "block";
        menu.style.opacity = "1";
        if (event != null) {
            menu.style.left = (event.clientX + 15) + "px";
            menu.style.top = (event.pageY - 10) + "px";
        }
        ;
        if (elem != null) document.body.appendChild(menu);
    },
    hideMenu : function (menuId) {
        var menu = MigScript.DomUtil.ge(menuId);
        MigScript.UI.animateHide(menu);
    }

};

MigScript.UI.Group = {
    markFriends: function () {
        if (MigScript.Friends.friendList == null) MigScript.Friends.getFriends(MigScript.UI.Group.markFriends); else {
            for (var i = 0; i < MigScript.Friends.friendList.length; i++) {
                var div = MigScript.DomUtil.ge("memRow" + MigScript.Friends.friendList[i][0]);
                if (div != null) {
                    div.style.background = '#ffff00';
                }
            }
            ;
        }
    },
    createMngButton : function (label, id, onClick) {
        var s_row = MigScript.DomUtil.dc("div");
        s_row.className = "s_row";

        var div = MigScript.DomUtil.dc("div");
        div.className = "s_pad";
        div.id = id;
        var _label = document.createTextNode(label);
        div.appendChild(_label);
        div.addEventListener("click", onClick, true);
        div.addEventListener("mouseover", function() {
            this.className = "s_pad_over";
        }, true);
        div.addEventListener("mouseout", function() {
            this.className = "s_pad";
        }, true);
        s_row.appendChild(div);
        return s_row;
    },
    addReplyButtons: function() {
        var div0 = MigScript.DomUtil.ge("rows_content");
        var arr = div0.getElementsByTagName("div");


        MigScript.UI.Group.addReplyButton(arr);

    },
    addReplyButton :function(arr) {
        for (var i = 0; i < arr.length; i++) {
            var el = arr[i];
            if (el.className == "postIndex") {

                var postIndex = el.innerHTML;
            }

            if (el.className == "postBody") {

                for (var j = 0; j < el.childNodes.length; j++) {
                    var node = el.childNodes[j];

                    if (node.className == "postHeader") {
                        var head = node;
                        var author = node.getElementsByTagName("a")[0].innerHTML;
                    }
                    if (j == el.childNodes.length - 1) {
                        var a = MigScript.DomUtil.dc("a");

                        head.appendChild(a);
                        a.innerHTML = "<b>[Ответить]</b>";
                        a.style.cursor = "pointer";
                        a.style.setProperty("float", "right", "");
                        a.style.marginTop = "-20px";
                        a.style.marginLeft = "100px";
                        a.setAttribute("str", "@ " + postIndex + "  " + author + ":\n\n");
                        a.addEventListener("click", function() {
                            MigScript.DomUtil.ge("post").value += this.getAttribute("str");
                            MigScript.DomUtil.ge("post").focus();
                        }, true);
                    }
                }
            }
        }
    }
};

MigScript.UI.ExFriends = {
    isShown : null,
    isOpen : null,
    createMenu : function () {
        var div;
        if (div = MigScript.DomUtil.ge("fr_cont") == null) {
            div = MigScript.DomUtil.dc("div");
            div.id = "fr_cont";
            div.className = "fr_cont";
            MigScript.DomUtil.ge("sideBar").appendChild(div);


            var div2 = MigScript.DomUtil.dc("div");
            div2.id = "fr_txt";
            div2.className = "fr_txt";

            div.appendChild(div2);

            var div3 = MigScript.DomUtil.dc("div");
            div3.id = "fr_list";
            div3.className = "fr_list";
            if (!MigScript.UI.ExFriends.isOpen) {
                div3.style.display = "none";
            } else {
                div3.style.display = "block";
            }

            div.appendChild(div3);

            var div4 = MigScript.DomUtil.dc("div");
            div4.id = "nd_chk";
            div.appendChild(div4);

            var a = MigScript.DomUtil.dc("a");
            a.style.cursor = "pointer";
            a.style.color = "#0000ff";
            var c = MigScript.DomUtil.dc("center");
            a.innerHTML = "[Проверить]";
            c.appendChild(a);
            a.addEventListener("click", function() {
                MigScript.ExFriends.forceCheckFriends();
            }, true);
            div4.appendChild(c);
        }
        if (MigScript.Util.notNullCount(MigScript.ExFriends.exFriends) == 0) {
            div2 = MigScript.DomUtil.ge("fr_txt");
            div3 = MigScript.DomUtil.ge("fr_list");
            MigScript.DomUtil.removeChildNodes(div2);
            div2.innerHTML = "В списке друзей всё спокойно";
            MigScript.DomUtil.removeChildNodes(div3);
            div3.style.display = "none";
        } else {
            MigScript.UI.ExFriends.notify();

            MigScript.UI.ExFriends.alertDel(MigScript.Util.notNullCount(MigScript.ExFriends.exFriends));
        }
    },

    notify : function () {
        // MigScript.log("notify enter");
        if (MigScript.UI.ExFriends.isShown) {
            // MigScript.log("ex is shown");
            var div = MigScript.DomUtil.ge("fr_list");
            MigScript.DomUtil.removeChildNodes(div);
            //MigScript.log("before cycle ");
            for (var i = 1; i <= MigScript.ExFriends.exFriends.length; i++) {
                //  MigScript.log("notify cycle " + i);
                var ndiv = MigScript.DomUtil.dc("div");
                ndiv.id = "nd" + i;
                ndiv.className = "fr_pad";
                ndiv.innerHTML = i + ". &nbsp;";

                var c_link = MigScript.DomUtil.dc("div");
                c_link.className = "c_link";


                var link = MigScript.DomUtil.dc("a");
                link.href = MigScript.HOST + "/id" + MigScript.ExFriends.exFriends[i - 1][0];
                link.innerHTML = MigScript.ExFriends.exFriends[i - 1][1] + "</a>&nbsp;";
                link.style.color = "#0000ff";
                link.target = "_blank";
                c_link.appendChild(link);
                ndiv.appendChild(c_link);

                ndiv.addEventListener("mouseover", function() {
                    MigScript.DomUtil.highlight(this);
                }, true);
                ndiv.addEventListener("mouseout", function() {
                    MigScript.DomUtil.unlight(this);
                }, true);

                var crossDiv = MigScript.DomUtil.dc("div");
                crossDiv.className = "cross";
                var a = MigScript.DomUtil.dc("a");
                a.innerHTML = "[x]";
                a.style.color = "#ff0000";
                a.style.cursor = "pointer";
                a.id = "cross" + i;
                //a.className = "cross";
                a.addEventListener("click", function() {
                    MigScript.UI.ExFriends.deleteNotification(this.id);
                }, true);
                ndiv.insertBefore(crossDiv, c_link);
                crossDiv.appendChild(a);
                div.appendChild(ndiv);

            }
        }
    },

    alertDel : function (i) {
        var div = MigScript.DomUtil.ge("fr_txt");
        MigScript.log("exFr not null: " + i);
        if (i == 0) {
            MigScript.UI.ExFriends.createMenu();
        } else {
            div.innerHTML = "<font color='#2B587A'><center><b><u>Бывшие друзья</u></b></font><br>У вас <br><b>" + i + "</b> человек в списке бывших друзей!</center>";
            if (MigScript.DomUtil.ge("nd_btn") == null) {
                var a = MigScript.DomUtil.dc("a");
                a.id = "nd_btn";
                if (MigScript.DomUtil.ge("fr_list").style.display == "none") {
                    a.innerHTML = "[+]";
                    a.title = "Развернуть";
                } else {
                    a.innerHTML = "[-]";
                    a.title = "Свернуть";
                }

                a.style.cursor = "pointer";
                a.style.fontSize = "8pt";
                a.addEventListener("click", function() {
                    MigScript.UI.ExFriends.toggleList();
                }, true);
                div.appendChild(a);
            }
        }
    },

    deleteNotification : function (id) {
        var i = id.substring(5);
        var div = MigScript.DomUtil.ge("fr_list");
        div.removeChild(MigScript.DomUtil.ge("nd" + i));
        MigScript.ExFriends.exFriends[i - 1] = null;
        MigScript.Util.serialize("exFriends", MigScript.ExFriends.exFriends);
        MigScript.UI.ExFriends.alertDel(MigScript.Util.notNullCount(MigScript.ExFriends.exFriends));
    },

    toggleList : function () {
        MigScript.UI.ExFriends.notify();
        MigScript.DomUtil.toggle(MigScript.DomUtil.ge("fr_list"));
        MigScript.UI.togglePlusBtn("nd_btn");
        MigScript.UI.ExFriends.isOpen = !MigScript.UI.ExFriends.isOpen;
        MigScript.Util.serialize("frList_open", MigScript.UI.ExFriends.isOpen);
    },
    showProgress : function () {
        if (MigScript.UI.ExFriends.isShown) {
            MigScript.DomUtil.ge("fr_txt").innerHTML = "<center><img src=\"" + MigScript.UI.Images.loaderImg() + "\"/></center>";
        }
    },
    init: function () {
        MigScript.UI.ExFriends.isShown = MigScript.Settings.local_settings[2];
        MigScript.UI.ExFriends.isOpen = MigScript.Util.deserialize("frList_open", false);
        if (MigScript.UI.ExFriends.isShown) {
            MigScript.UI.ExFriends.createMenu();
        }
    }
};

MigScript.UI.OnlineFriends = {
    isShown: null,
    isFloat: null,
    isOpen : null,
    floater : null,
    createStaticList: function () {
        var div = MigScript.DomUtil.ge("ol_cont");
        if (div == null) {
            div = MigScript.DomUtil.dc("div");
            div.id = "ol_cont";
            div.className = "fr_cont";
            //div.style.width = "100px";
            div.style.marginTop = "10px";
            MigScript.DomUtil.ge("sideBar").appendChild(div);

            var cdiv = MigScript.DomUtil.dc("div");
            cdiv.id = "c_div";
            div.appendChild(cdiv);

            var a;
            if (MigScript.DomUtil.ge("ol_roll_btn") == null) {
                a = MigScript.DomUtil.dc("a");
                a.id = "ol_roll_btn";
                a.innerHTML = "<b>^</b>";
                a.title = "Отцепить";
                a.style.cursor = "pointer";
                a.style.fontSize = "8pt";
                a.style.marginLeft = "70px";
                a.addEventListener("click", function(e) {
                    MigScript.UI.OnlineFriends.isFloat = true;
                    MigScript.Util.serialize("olFloat", true);
                    MigScript.DomUtil.ge("ol_cont").style.setProperty("display", "none", "important");
                    MigScript.UI.OnlineFriends.createList(e);
                }, true);
                cdiv.appendChild(a);
            }

            MigScript.UI.OnlineFriends.isOpen = MigScript.Util.deserialize("olStatic_open", false);

            if (MigScript.DomUtil.ge("ol_btn") == null && MigScript.OnlineFriends.onlineFriends.length > 0) {
                a = MigScript.DomUtil.dc("a");
                a.id = "ol_btn";
                if (!MigScript.UI.OnlineFriends.isOpen) {
                    a.innerHTML = "[+]";
                    a.title = "Развернуть";
                } else {
                    a.innerHTML = "[-]";
                    a.title = "Свернуть";
                }
                a.style.cursor = "pointer";
                a.style.fontSize = "8pt";
                a.style.marginLeft = "5px";
                a.addEventListener("click", function() {
                    MigScript.UI.OnlineFriends.toggleStaticList();
                }, true);
                cdiv.appendChild(a);
            }

            var div2 = MigScript.DomUtil.dc("div");
            div2.id = "ol_txt";
            div2.className = "fr_txt";
            div.appendChild(div2);


            var div3 = MigScript.DomUtil.dc("div");
            div3.id = "ol_list";
            div3.className = "fr_list";
            if (!MigScript.UI.OnlineFriends.isOpen) {
                div3.style.display = "none";
            } else {
                div3.style.display = "block";
            }

            div.appendChild(div3);
        } else {
            div.style.setProperty("display", "block", "important");

        }
    },
    toggleStaticList: function() {
        MigScript.DomUtil.toggle(MigScript.DomUtil.ge("ol_list"));
        MigScript.UI.togglePlusBtn("ol_btn");
        MigScript.UI.OnlineFriends.isOpen = ! MigScript.UI.OnlineFriends.isOpen;
        MigScript.Util.serialize("olStatic_open", MigScript.UI.OnlineFriends.isOpen);
    },
    createFloatList : function(e) {

        MigScript.UI.OnlineFriends.isFloat = true;
        var x,y;
        if (e) {
            x = e.pageX - 30;
            y = e.pageY - 50;
        } else {
            x = MigScript.Util.deserialize("olFloat_x", 0);
            y = MigScript.Util.deserialize("olFloat_y", 0);
        }
        if (!MigScript.UI.OnlineFriends.floater) {
            MigScript.UI.OnlineFriends.floater = new MigScript.CustomObjects.FloaterClass(x, y, "olFloat", "Онлайн", {minWidth: 105, width: MigScript.Util.deserialize("olFloat_W", 0) ,height: MigScript.Util.deserialize("olFloat_H", 0)});
            MigScript.UI.OnlineFriends.floater.onClose = function() {
                MigScript.Util.serialize("olFloat", false);
                MigScript.UI.OnlineFriends.isFloat = false;
                MigScript.UI.OnlineFriends.createList();
            };
        } else {
            MigScript.UI.OnlineFriends.floater.wakeUp(x, y);
        }
    },
    createList : function (e) {
        if (MigScript.DomUtil.ge("friendsOnline") && MigScript.Util.checkLocation("id" + MigScript.myUid)) {
            MigScript.DomUtil.ge("friendsOnline").style.display = "none";
        }
        if (!MigScript.UI.OnlineFriends.isFloat) {
            MigScript.UI.OnlineFriends.createStaticList();
        } else {
            MigScript.UI.OnlineFriends.createFloatList(e);
        }
        MigScript.UI.OnlineFriends.notifyNumber();
        MigScript.UI.OnlineFriends.addPeople();
    },
    addPeople : function() {
        if (!MigScript.UI.OnlineFriends.isFloat) {
            MigScript.UI.OnlineFriends.addStaticPeople();
        } else {
            MigScript.UI.OnlineFriends.addFloatPeople();
        }
    },
    addStaticPeople : function () {
        if (MigScript.UI.OnlineFriends.isShown) {
            var div = MigScript.DomUtil.ge("ol_list");
            MigScript.DomUtil.removeChildNodes(div);
            for (var i = 1; i <= MigScript.OnlineFriends.onlineFriends.length; i++) {
                var ndiv = MigScript.DomUtil.dc("div");
                ndiv.id = "nd" + i;
                //Используем стиль модуля слежения за друзьями
                if (!MigScript.Friends.isFavFriend(MigScript.OnlineFriends.onlineFriends[i - 1][0])) {
                    ndiv.className = "fr_pad";
                } else {
                    ndiv.className = "fav_fr_pad";
                }
                var c_link = MigScript.DomUtil.dc("div");
                c_link.className = "c_link";


                var link = MigScript.DomUtil.dc("a");
                link.href = MigScript.HOST + "/id" + MigScript.OnlineFriends.onlineFriends[i - 1][0];
                link.innerHTML = MigScript.OnlineFriends.onlineFriends[i - 1][1];
                //link.style.color = "#0000ff";
                link.target = "_top";
                link.addEventListener("mouseover", function(e) {
                    var uid = this.href.substring(this.href.indexOf("/id") + 3);
                    MigScript.UI.showAvatar(uid, e.clientX, 100, e.pageY, MigScript.DomUtil.ge("ol_list").width);
                }, true);
                link.addEventListener("mouseout", function(e) {
                    var uid = this.href.substring(this.href.indexOf("/id") + 3);
                    MigScript.UI.hideAvatar(uid);
                }, true);
                c_link.appendChild(link);
                ndiv.appendChild(c_link);

                ndiv.addEventListener("mouseover", function() {
                    MigScript.DomUtil.highlight(this);
                }, true);
                ndiv.addEventListener("mouseout", function() {
                    MigScript.DomUtil.unlight(this);
                }, true);
                div.appendChild(ndiv);

            }
        }
    },
    notifyNumber : function() {
        var div;
        if (!MigScript.UI.OnlineFriends.isFloat) {
            div = MigScript.DomUtil.ge("ol_txt");

        } else {
            div = MigScript.UI.OnlineFriends.floater.txt;
        }
        div.innerHTML = "Онлайн <b>" + MigScript.OnlineFriends.onlineFriends.length + "</b> человек";
    },
    addFloatPeople : function() {
        if (MigScript.UI.OnlineFriends.isShown) {
            var div = MigScript.UI.OnlineFriends.floater.body;
            MigScript.DomUtil.removeChildNodes(div);
            for (var i = 1; i <= MigScript.OnlineFriends.onlineFriends.length; i++) {
                var ndiv = MigScript.DomUtil.dc("div");
                ndiv.id = "nd" + i;
                //Используем стиль модуля слежения за друзьями
                if (!MigScript.Friends.isFavFriend(MigScript.OnlineFriends.onlineFriends[i - 1][0])) {
                    ndiv.className = "fr_pad";
                } else {
                    ndiv.className = "fav_fr_pad";
                }
                var c_link = MigScript.DomUtil.dc("div");
                c_link.className = "floater_link";


                var link = MigScript.DomUtil.dc("a");
                var uid = MigScript.OnlineFriends.onlineFriends[i - 1][0];
                link.href = MigScript.HOST + "/id" + uid;
                link.innerHTML = MigScript.OnlineFriends.onlineFriends[i - 1][1];
                //link.style.color = "#0000ff";
                link.target = "_top";
                link.addEventListener("mouseover", function(e) {
                    var uid = this.href.substring(this.href.indexOf("/id") + 3);
                    MigScript.UI.showAvatar(uid, e.clientX, 170, e.pageY, MigScript.UI.OnlineFriends.floater.body.offsetWidth);
                }, true);
                link.addEventListener("mouseout", function(e) {
                    var uid = this.href.substring(this.href.indexOf("/id") + 3);
                    MigScript.UI.hideAvatar(uid);
                }, true);
                c_link.appendChild(link);
                ndiv.appendChild(c_link);

                ndiv.addEventListener("mouseover", function() {
                    MigScript.DomUtil.highlight(this);
                }, true);
                ndiv.addEventListener("mouseout", function() {
                    MigScript.DomUtil.unlight(this);
                }, true);
                div.appendChild(ndiv);

            }
        }
    },
    init : function() {
        MigScript.UI.OnlineFriends.isShown = MigScript.Settings.local_settings[12];
        MigScript.UI.OnlineFriends.isFloat = MigScript.Util.deserialize("olFloat", false);
        if (MigScript.UI.OnlineFriends.isShown) {
            MigScript.UI.OnlineFriends.createList();
        }
    }
};

MigScript.UI.WhoFaved = {
    isShown : null,
    container : null,
    openContainer : function(e) {
        MigScript.Util.serialize("wf_isShown", true);
        MigScript.UI.WhoFaved.isShown = true;
        var x,y;
        if (e) {
            x = e.pageX - 30;
            y = e.pageY - 50;
        } else {
            x = MigScript.Util.deserialize("favedList_x", 0);
            y = MigScript.Util.deserialize("favedList_y", 0);
        }
        MigScript.UI.WhoFaved.container = new MigScript.CustomObjects.FloaterClass(x, y, "favedList", "Я в закладках", {minWidth: 105, width: MigScript.Util.deserialize("favedList_W", 0) ,height: MigScript.Util.deserialize("favedList_H", 0)});
        MigScript.UI.WhoFaved.container.onClose = function() {
            MigScript.Util.serialize("wf_isShown", false);
            MigScript.UI.WhoFaved.isShown = false;
        };

        var a = MigScript.DomUtil.dc("a");
        a.style.cursor = "pointer";
        a.addEventListener("click", function() {
            MigScript.WhoFaved.getList(function() {
                MigScript.UI.WhoFaved.addPeople();
                MigScript.UI.WhoFaved.container.txt.childNodes[0].innerHTML = "[Проверить]";
            });
            this.innerHTML = "<img src=\"" + MigScript.UI.Images.loaderImg() + "\"/>";
        }, true);
        a.innerHTML = "[Проверить]";

        MigScript.UI.WhoFaved.container.wrapCont.style.setProperty("width", "165px", "important");
        MigScript.UI.WhoFaved.container.txt.appendChild(a);
    },
    addPeople : function() {
        if (MigScript.UI.WhoFaved.isShown) {
            var div = MigScript.UI.WhoFaved.container.body;
            MigScript.DomUtil.removeChildNodes(div);
            if (MigScript.WhoFaved.favedList) {
                for (var i = 1; i <= MigScript.WhoFaved.favedList.length; i++) {
                    var ndiv = MigScript.DomUtil.dc("div");
                    ndiv.id = "nd" + i;
                    //Используем стиль модуля слежения за друзьями
                    if (!MigScript.Friends.isFavFriend(MigScript.WhoFaved.favedList[i - 1][0])) {
                        ndiv.className = "fr_pad";
                    } else {
                        ndiv.className = "fav_fr_pad";
                    }
                    var c_link = MigScript.DomUtil.dc("div");
                    c_link.className = "floater_link";


                    var link = MigScript.DomUtil.dc("a");
                    var uid = MigScript.WhoFaved.favedList[i - 1][0];
                    link.href = MigScript.HOST + "/id" + uid;
                    link.innerHTML = MigScript.WhoFaved.favedList[i - 1][1];
                    //link.style.color = "#0000ff";
                    link.target = "_top";
                    link.addEventListener("mouseover", function(e) {
                        var uid = this.href.substring(this.href.indexOf("/id") + 3);
                        MigScript.UI.showAvatar(uid, e.clientX, 150, e.pageY, MigScript.UI.WhoFaved.container.body.style.width, MigScript.WhoFaved.favedList);
                    }, true);
                    link.addEventListener("mouseout", function(e) {
                        var uid = this.href.substring(this.href.indexOf("/id") + 3);
                        MigScript.UI.hideAvatar(uid);
                    }, true);
                    c_link.appendChild(link);
                    ndiv.appendChild(c_link);

                    ndiv.addEventListener("mouseover", function() {
                        MigScript.DomUtil.highlight(this);
                    }, true);
                    ndiv.addEventListener("mouseout", function() {
                        MigScript.DomUtil.unlight(this);
                    }, true);
                    div.appendChild(ndiv);

                }
            }
        }
    },
    open : function(e) {
        var div = MigScript.DomUtil.ge("favedList");
        MigScript.Util.serialize("wf_isShown", true);
        MigScript.UI.WhoFaved.isShown = true;
        if (!div) {
            MigScript.UI.WhoFaved.openContainer(e);
            MigScript.UI.WhoFaved.addPeople();

            /*MigScript.WhoFaved.getList(function() {
             MigScript.UI.WhoFaved.addPeople();
             MigScript.UI.WhoFaved.container.txt.childNodes[0].innerHTML = "[Проверить]";
             });*/
            //MigScript.UI.WhoFaved.container.txt.childNodes[0].innerHTML = "<img src=\"" + MigScript.UI.Images.loaderImg() + "\"/>";

        } else {
            div.style.setProperty("display", "block", "important");
        }

    },
    init : function() {
        MigScript.UI.WhoFaved.isShown = MigScript.Util.deserialize("wf_isShown", false);

        if (MigScript.UI.WhoFaved.isShown) {

            MigScript.UI.WhoFaved.openContainer();
            MigScript.UI.WhoFaved.addPeople();
        }
    }
};

MigScript.Styler = {
    skinList: new Array(),
    getSkinsList : function (id) {
        if (!MigScript.opera) {
            var url = MigScript.CSS_HOST + "/getlist.php?sortby=name";
            GM_xmlhttpRequest({method:"GET",url:url,onreadystatechange:function(o) {
                if (o.readyState == 4) {
                    MigScript.Styler.parseSkinList(o.responseText);
                    MigScript.DomUtil.ge("ddplace").appendChild(MigScript.Styler.getSelect());
                    MigScript.DomUtil.ge("skinimg").src = MigScript.UI.Images.noDataImg();
                    if (MigScript.Settings.local_settings[11] == null || MigScript.Settings.local_settings[11] == "" || MigScript.Settings.local_settings[11] == "Стандартный") {
                        MigScript.Styler.showSkinInfo(MigScript.Styler.skinList[0]);
                    } else {
                        for (var i = 0; i < MigScript.Styler.skinList.length; i++) {
                            if (MigScript.Styler.skinList[i].name == MigScript.Settings.local_settings[11]) {
                                MigScript.Styler.showSkinInfo(MigScript.Styler.skinList[i]);
                            }
                        }
                    }

                }
            }});
        }
    },

    parseSkinList: function(json) {
        if (json.charAt(0) != "[") {
            json = "[" + json.substr(1);
        }
        if (json.charAt(json.length - 1) != "]") {
            json = json + json.substring(0, json.length - 1) + "]";
        }
        // MigScript.log(json);

        MigScript.Styler.skinList = eval("(" + json + ")");
    },

    getSelect: function () {
        var select = MigScript.DomUtil.ge("config_css_dropdown");
        if (!select) {
            select = MigScript.DomUtil.dc("select");
            select.multiple = "";
            select.size = "15";
            select.id = "config_css_dropdown";
            select.addEventListener("change", function(e) {
                var thid = e.target.value;
                var skin = MigScript.Styler.skinList[thid];
                MigScript.Styler.showSkinInfo(skin);
            }, false);
            for (var i = 0; i < MigScript.Styler.skinList.length; i++) {
                var opt = MigScript.DomUtil.dc("option");
                opt.value = i;
                opt.innerHTML = MigScript.Styler.skinList[i].name;
                select.appendChild(opt);
            }
            ;
        }
        return select;
    },

    createSkinSelector : function() {
        MigScript.UI.Dialog.getDialog("Выберите скин");
        var t = MigScript.DomUtil.dc("table");
        var r = MigScript.DomUtil.dc("tr");
        t.appendChild(r);
        MigScript.DomUtil.ge("dlg_body").appendChild(t);

        var td0 = MigScript.DomUtil.dc("td");
        td0.style.width = "250px";
        td0.style.height = "300px";
        //s1.style.setProperty("float", "left", "");
        td0.id = "skinimg_c";
        r.appendChild(td0);


        var im = MigScript.DomUtil.dc("img");
        im.style.width = "250px";
        im.style.maxHeight = "300px";
        im.id = "skinimg";
        im.src = MigScript.UI.Images.loaderImg();
        td0.appendChild(im);

        var td1 = MigScript.DomUtil.dc("td");
        td1.style.verticalAlign = "top";
        r.appendChild(td1);

        var d = MigScript.DomUtil.dc("div");
        d.id = "ddplace";

        td1.appendChild(d);

        var d2 = MigScript.DomUtil.dc("div");
        d2.style.marginTop = "10px";
        d2.id = "skininfo";
        td1.appendChild(d2);

        var ok_btn = MigScript.DomUtil.ge("skin_ok_btn");
        if (ok_btn == null) {
            ok_btn = MigScript.DomUtil.dc("div");
            ok_btn.id = "skin_ok_btn";
            MigScript.DomUtil.ge("dlg_ok_btn").appendChild(ok_btn);
        }
        ok_btn.className = "box_button";
        ok_btn.innerHTML = "Установить скин";


        ok_btn.addEventListener("click", function() {
            var i = MigScript.DomUtil.ge("config_css_dropdown").value;
            var skin = MigScript.Styler.skinList[i];
            MigScript.Styler.installSkin(skin.id);
            MigScript.DomUtil.ge("config_css_select").innerHTML = skin.name;
            MigScript.DomUtil.ge("config_css_select").setAttribute("value", skin.name);
            MigScript.UI.Dialog.destroyDlg();
        }, true);

    },

    showSkinSelector : function() {

        MigScript.Styler.createSkinSelector();
        MigScript.Styler.getSkinsList();
        //        MigScript.Styler.showSkinInfo(MigScript.Styler.skinList[i]);
    },

    showSkinInfo : function(skin) {

        var img = null;
        try {
            img = skin.img;
            if (img) {
                MigScript.DomUtil.ge("skinimg").src = img;
            } else {
                var url = MigScript.CSS_HOST + "/getimg.php?id=" + skin.id + "&body=1";
                MigScript.DomUtil.ge("skinimg").src = MigScript.UI.Images.loaderImg();
                GM_xmlhttpRequest({method:"GET",url:url,onreadystatechange:function(o) {
                    if (o.readyState == 4) {
                        MigScript.DomUtil.ge("skinimg").src = o.responseText;
                    }
                }});
            }
        } catch(e) {
        } finally {
            MigScript.DomUtil.ge("skininfo").innerHTML = "Скин <b>" + skin.name + "</b> <br>Автор: " + skin.author + "<br>Комментарий: " + skin.comment;
        }
        ;
    },

    installSkin:function (id) {
        var url = MigScript.CSS_HOST + "/getcss.php?id=" + id;
        // MigScript.log(url);
        GM_xmlhttpRequest({method:"GET",url:url,onreadystatechange:function(o) {
            if (o.readyState == 4) {
                MigScript.DomUtil.ge("config_userstyle").value = o.responseText;
            }
        }});
    },

    getDefaultStyle : function () {
        return "#message{"
                + "background-color: #ffffaa;"
                + "}"
                + ".comment .header{"
                + "background-color: #ffeeaa;"
                + "}"
                + ".mailbox table th{"
                + "background-color: #ffeeaa;"
                + "}"
                + MigScript.Styler.getZeroStyle();
    },
    getZeroStyle : function() {
        return ".fr_cont{"
                + " background:transparent!important;"
                + " display: block!important;"
                + "	margin-top: 6px!important;"
                + " padding: 3px!important;"
                + " min-width: 112px!important;"
                + " }"
                + "					"
                + "	.fr_txt{"
                + " border-bottom: 1px solid #B1BDD6!important;"
                + "background-color: rgba(200,200,200,0.4)!important;"
                + "}"
                + "					"
                + " .fr_list{"
                + "	border-bottom: 1px solid ##B1BDD6!important;"
                + "}"
                + "					"
                + " .fr_pad{"
                + " background-color: rgba(220,220,220,0.3)!important;"
                + " vertical-align: middle!important;"
                + " display: block!important;"
                + " text-align: left!important;"
                + " word-wrap: break-line!inportant;"
                + " width: 99px!important;"
                + " float:left!important;"
                + " min-height:26px!important;"
                + " padding-left:5px!important;"
                + " border-right:1px dashed #ADBBCA!important;"
                + " border-bottom:1px dashed #ADBBCA!important;"
                + "}"
                + "					"
                + " .fr_pad_h{"
                + " background-color: rgba(200,200,200,0.9)!important;"
                + " vertical-align: middle!important;"
                + " text-align: left!important;"
                + " display: block!important;"
                + " opacity: 0.6!important;"
                + "word-wrap: break-line!important;"
                + "width: 99px!important;"
                + "float:left!important;"
                + " min-height:26px!important;"
                + " padding-left:5px!important;"
                + " border-right:1px dashed #ADBBCA!important;"
                + " border-bottom:1px dashed #ADBBCA!important;"
                + "}"
                + " .fav_fr_pad{"
                + " background-color:  rgba(180,180,180,0.5)!important;"
                + " vertical-align: middle!important;"
                + " font-weight: bold!important;"
                + " display: block!important;"
                + " text-align: left!important;"
                + "word-wrap: break-line!important;"
                + "width:99px!important;"
                + "float:left!important;"
                + " min-height:26px!important;"
                + " padding-left:5px!important;"
                + " border-right:1px dashed #ffffff!important;"
                + " border-bottom:1px dashed #ffffff!important;"
                + "}"
                + ".fav_fr_pad_h{"
                + " background-color: rgba(180,180,180,0.8)!important;"
                + " vertical-align: middle!important;"
                + " text-align: left!important;"
                + " font-weight: bold!important;"
                + " display: block!important;"
                + " opacity: 0.6!important;"
                + " word-wrap: break-line!important;"
                + " width: 99px!important;"
                + " float:left!important;"
                + " min-height:26px!important;"
                + " padding-left:5px!important;"
                + " border-right:1px dashed #ffffff!important;"
                + " border-bottom:1px dashed #ffffff!important;"
                + "}"
                + ""
                + "#nd_btn{"
                + "float:right!important;" +
               " margin-top: -14px;"
                + "}"
                + "					"
                + ".css_preview{"
                + " width: 350px;"
                + "}"
                + " .floater_cont{"
                + " background: transparent!important;"
                + " position: absolute!important;"
                + " z-index: 200!important;"
                + " text-align: left!important;"
                + " display: block!important;"
                + "}"
                + " .floater_head{"
                + " background-color: rgba(180,180,180,0.5)!important;"
                + " display: block!important;"
                + "height: 20px!important;"
                + "border-bottom: 1px solid #B1BDD6!important;"
                + "}"
                + " .floater_body{"
                + " text-align: left!important;"
                + " display: block!important;"
                + "}"
                + " .floater_txt{"
                + " border-bottom: 1px solid #B1BDD6!important;"
                + " height : 15px!important;"
                + " text-align: center!important;"
                + "background-color: rgba(255,255,255, 0.3)!important;"
                + "}"
                + " .floater_pad{"
                + " background-color: #efe!important;"
                + " vertical-align: middle!important;"
                + " display: block!important;"
                + " text-align: left!important;"
                + "}"
                + "					"
                + " .floater_pad_h{"
                + " background-color: #ddd!important;"
                + " vertical-align: middle!important;"
                + " text-align: left!important;"
                + " display: block!important;"
                + " opacity: 0.6!important;"
                + "}"
                + ".alert_cont{"
                + " position : fixed!important;"
                + " background: transparent!important;"
                + " border: 1px solid #B1BDD6!important;"
                + " z-index: 300!important;"
                + " width: 150px!important;"
                + " text-align: left!important;"
                + " vertical-align: middle!important;"
                + " display: block!important;"
                + " opacity: 1;"
                + "}"
                + ".alert_body{"
                + " display: block!important;"
                + " min-height: 20px!important;"
                + " max-height: 150px!important;"
                + " vertical-align: middle!important;"
                + " padding: 3px!important;"
                + "overflow: auto!important;"
                + "background-color: rgba(255,255,255,0.5)!important;"
                + "}"
                + ".alert_head{"
                + " background-color: rgba(180,180,180,0.6)!important;"
                + " display: block!important;"
                + " vertical-align: middle!important;"
                + "height: 20px!important;"
                + "border-bottom: 1px solid #B1BDD6!important;"
                + "}"
                + ".alert_capt{"
                + "float: left!important;"
                + "width: 130px!important;"
                + "}"
                + ".message_alert_cont{"
                + " position : fixed!important;"
                + " background: transparent!important;"
                + " border: 1px solid #daa520!important;"
                + " z-index: 300!important;"
                + " width: 150px!important;"
                + " text-align: left!important;"
                + " vertical-align: middle!important;"
                + " display: block!important;"
                + " opacity: 1;"
                + "}"
                + ".message_alert_body{"
                + " display: block!important;"
                + " min-height: 20px!important;"
                + " max-height: 150px!important;"
                + " vertical-align: middle!important;"
                + " padding: 3px!important;"
                + "overflow: auto!important;"
                + "background-color: rgba(255,238,0,0.7)!important;"
                + "}"
                + ".message_alert_head{"
                + " background-color: rgba(255,215,0,0.8)!important;"
                + " display: block!important;"
                + " vertical-align: middle!important;"
                + "height: 20px!important;"
                + "border-bottom: 1px solid #daa520!important;"
                + "}"
                + ".message_alert_capt{"
                + "float: left!important;"
                + "width: 130px!important;"
                + "}"
            // +"#sideBar{position:fixed!important;}"

                + ".friends_alert_cont{"
                + " position : fixed!important;"
                + " background-color: #FFF68F!important;"
                + " border: 1px solid #8B864E!important;"
                + " z-index: 300!important;"
                + " width: 150px!important;"
                + " text-align: left!important;"
                + " vertical-align: middle!important;"
                + " display: block!important;"
                + " opacity: 1;"
                + "}"
                + ".friends_alert_body{"
                + " display: block!important;"
                + " min-height: 20px!important;"
                + " max-height: 150px!important;"
                + " vertical-align: middle!important;"
                + " padding: 3px!important;"
                + "overflow: auto!important;"
                + "}"
                + ".friends_alert_head{"
                + " background-color: #BDB76B!important;"
                + " display: block!important;"
                + " vertical-align: middle!important;"
                + "height: 20px!important;"
                + "border-bottom: 1px solid #8B864E!important;"
                + "}"
                + ".friends_alert_capt{"
                + "float: left!important;"
                + "width: 130px!important;"
                + "}"

                + ".event_alert_cont{"
                + " position : fixed!important;"
                + "color: white;"
                + " background-color: #FF82AB!important;"
                + " border: 1px solid #8B475D!important;"
                + " z-index: 300!important;"
                + " width: 150px!important;"
                + " text-align: left!important;"
                + " vertical-align: middle!important;"
                + " display: block!important;"
                + " opacity: 1;"
                + "}"
                + ".event_alert_body{"
                + " display: block!important;"
                + " min-height: 20px!important;"
                + " max-height: 150px!important;"
                + " vertical-align: middle!important;"
                + " padding: 3px!important;"
                + "overflow: auto!important;"
                + "}"
                + ".event_alert_head{"
                + " background-color: #CD6889!important;"
                + " display: block!important;"
                + " vertical-align: middle!important;"
                + "height: 20px!important;"
                + "border-bottom: 1px solid #8B475D!important;"
                + "}"
                + ".event_alert_capt{"
                + "float: left!important;"
                + "width: 130px!important;"
                + "}"

                + ".media_alert_cont{"
                + " position : fixed!important;"
                + " background-color: #B3EE3A!important;"
                + " border: 1px solid #228B22!important;"
                + " z-index: 300!important;"
                + " width: 150px!important;"
                + " text-align: left!important;"
                + " vertical-align: middle!important;"
                + " display: block!important;"
                + " opacity: 1;"
                + "}"
                + ".media_alert_body{"
                + " display: block!important;"
                + " min-height: 20px!important;"
                + " max-height: 150px!important;"
                + " vertical-align: middle!important;"
                + " padding: 3px!important;"
                + "overflow: auto!important;"
                + "}"
                + ".media_alert_head{"
                + " background-color: #66CD00!important;"
                + " display: block!important;"
                + " vertical-align: middle!important;"
                + "height: 20px!important;"
                + "border-bottom: 1px solid #228B22!important;"
                + "}"
                + ".media_alert_capt{"
                + "float: left!important;"
                + "width: 130px!important;"
                + "}"
                + ".alertlink{"
                +"text-decoration: underline;"
                +"color: black;"
                +"font-weight: bold;"
                +"}"
                + " .menu_cont{"
                + " border: 1px solid #B1BDD6!important;"
                + " margin: 3px 0px 0px 0px!important;"
                + " padding: 0px 0px 0px 0px!important;"
                + " background-color: rgba(160,160,160,0.4)!important;"
                + " position: absolute!important;"
                + " z-index: 64990!important;"
                + "}"
                + "					"
                + " .menu_button{"
                + " width: 16px!important;"
                + " height: 16px!important;"
                + " margin: 0px 0px 0px 4px!important;"
                + " position: relative!important;"
                + " padding-right: 5px!important;"
                + " float: left!important;"
                + "}"
                + "#nav li a {" +
               " background-color:rgba(255,255,255,0.2)!important;" +
               " border:none!important;" +
               "}"
                + "#nav li a:hover {" +
               "background-color:rgba(220,220,220,0.6)!important;" +
               " border:none!important;" +
               "}" +
               ".leftAd, .leftInfo{" +
               "padding: 0px!important;" +
               "}" +

               ".resBody{" +
               "position:absolute!important;" +
               "}" +
               ".nwHandle{" +
               " cursor:nw-resize!important;" +
               "position:absolute!important;" +
            //"background-color: #B1BDD6;" +
               "}"
                + ".nHandle{" +
               "cursor:n-resize!important;" +
               "position:absolute!important;" +
               "border-bottom: 1px solid!important;" +
               "border-color: #B1BDD6!important;" +
               "}"
                + ".neHandle{" +
               " cursor:ne-resize!important;" +
               "position:absolute!important;" +
            //"background-color: #B1BDD6;" +
            //"border-bottom: 1px solid;" +
            //"border-color: #B1BDD6;" +
               "}"
                + ".eHandle{" +
               " cursor:e-resize!important;" +
               "position:absolute!important;" +
            //"background-color: #B1BDD6;" +
               "border-left: 1px solid!important;" +
               "border-color: #B1BDD6!important;" +
               "}"
                + ".seHandle{" +
               " cursor:se-resize!important;" +
               "position:absolute!important;" +
            //"background-color: #B1BDD6;" +
            //"border-bottom: 1px solid;" +
            //"border-color: #B1BDD6;" +
               "}"
                + ".sHandle{" +
               " cursor:s-resize!important;" +
               "position:absolute!important;" +
            //"background-color: #B1BDD6;" +
               "border-top: 1px solid!important;" +
               "border-color: #B1BDD6!important;" +
               "}"
                + ".swHandle{" +
               " cursor:sw-resize!important;" +
               "position:absolute!important;" +
            //"background-color: #B1BDD6;" +
               "}"
                + ".wHandle{" +
               " cursor:w-resize!important;" +
               "position:absolute!important;" +
            //"background-color: #B1BDD6;" +
               "border-right: 1px solid!important;" +
               "border-color: #B1BDD6!important;" +
               "}";
    },
    prepareUI : function() {
        function check(arr) {
            for (var i = 0; i < arr.length; i++) {
                if (arr[i].id.match(/\d+/)) {
                    arr[i].href = "";
                    // var id = arr[i].id;
                    arr[i].addEventListener("click", function() {
                        var url = MigScript.CSS_HOST + "/getcss.php?id=" + this.id;
                        GM_xmlhttpRequest({method:"GET",url:url,onreadystatechange:function(o) {
                            if (o.readyState == 4) {
                                var x = null;
                                try {
                                    x = eval("(" + o.responseText + ")");
                                    alert(x.error);
                                } catch(e) {

                                }

                                if (x == null || !x.error) {
                                    MigScript.Settings.local_settings = MigScript.Util.deserialize("local_settings", new Array());
                                    MigScript.Settings.local_settings[8] = o.responseText;
                                    MigScript.Util.serialize("local_settings", MigScript.Settings.local_settings);
                                    alert("Скин установлен!");
                                } else {
                                    alert("Ошибка установки!");
                                }
                            }
                        }});
                    }, true);
                }
            }
        }

        ;

        if (MigScript.Util.checkLocation("catalog")) {
            //            console.log("catalog");
            //            var arr = document.getElementsByTagName("a");
            //            console.log(arr);
            //            check(arr);

            MigScript.DomUtil.ge("content").addEventListener("DOMNodeInserted", function(e) {
                var arr = e.target.getElementsByTagName("a");
                //console.log(arr
                check(arr);
            }, true);
        }

        // alert(MigScript.myUid);
    },

    init:function () {
        if (MigScript.Settings.local_settings != null && MigScript.Settings.local_settings != 'undefined' && MigScript.Settings.local_settings.length > 9)
            MigScript.ustyle = MigScript.Settings.local_settings[8];
        if (MigScript.ustyle == null) {
            MigScript.ustyle = MigScript.Styler.getDefaultStyle();
        }

        // Если мы не используем стиль, то используем желтый скин для модуля слежения
        if (MigScript.Settings.local_settings[7]) {
            GM_addStyle(MigScript.ustyle);
        }

        // Внутренние стили скрипта, добавляются в любом случае
        GM_addStyle(" #hider{"
                + " top: 0px;"
                + " left: 0px;"
                + " visibility: visible;"
                + " z-index : 1900;"
                + "	background-color: #0000ff;"
                + " opacity: 0.3;"
                + " position: absolute;"
                + " width: 100%;"
                + " }"
                + "					"
                + "#general #buttons{"
                + "	padding-right: 0px;"
                + " float: none;"
                + "}"
                + " #buttons{"
                + " border: 0px;"
                + " position: relative;"
                + " display: block;"
                + " width: 500px;"
                + "}"
                + "					"
                + " .vkbtn{"
                + " display: inline;"
                + " }"
                + "					"
                + " #s_table{"
                + " border: 0px;"
                + " padding: 10px;"
                + " position: relative;"
                + " width: 600px;"
                + "}"
                + "					"
                + " #s_table tr{"
                + " border: 0px;"
                + " width: 20px;"
                + "}"
                + " .td0{"
                + " border: 0px;"
                + " width: 300px;"
                + "}"
                + " .td1{"
                + " border: 0px;"
                + " width: 100px;"
                + " text-align: right;"
                + "}"
                + "					"
                + " .config_input{"
                + " width: 60px;"
                + " background-color: rgba(255,255,255,0.4);"
                + " text-align: center;"
                + " font-size: 16pt;"
                + "color: navy;"
                + " margin-left: 50px;"
                + "}"
                + "					"
                + ".c_link{"
                + " width : 100px;"
                + " display: inline-block;"
                + "}"
                + "					"
                + " .cross{"
                + " display: inline;"
                + " position: relative;"
                + "float:right;"
                + " cursor: pointer;"
                + "}"
                + "					"
                + " #sett_cont{"
                + " color: #ffffff;"
                + " display: inline;"
                + " position: absolute;"
                + " left: 160px;"
                + " top: 10px;"
                + "}"
                + "					"
                + "}"
                + "					"
                + " #sett_img{"
                + " position: relative;"
                + " width: 16px;"
                + " top: 3px;"
                + " left: 3px;"
                + " cursor: pointer;"
                + "}"
                + "					"
                + MigScript.Styler.getZeroStyle()
                );


    }

};

MigScript.Util = {
    sNum : function (i, j) {
        if (i.n < j.n) {
            return -1;
        }
        else if (i.n > j.n) {
            return 1;
        }
        else return 0;
    },
    getCookie : function(cname) {
        // first we'll split this cookie up into name/value pairs
        // note: document.cookie only returns name=value, not the other components
        var a_all_cookies = document.cookie.split(';');
        var a_temp_cookie = '';
        var cookie_name = '';
        var cookie_value = '';
        var b_cookie_found = false; // set boolean t/f default f

        for (var i = 0; i < a_all_cookies.length; i++)
        {
            // now we'll split apart each name=value pair
            a_temp_cookie = a_all_cookies[i].split('=');


            // and trim left/right whitespace while we're at it
            cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

            // if the extracted name matches passed check_name
            if (cookie_name == cname)
            {
                b_cookie_found = true;
                // we need to handle case where cookie has no value but exists (no = sign, that is):
                if (a_temp_cookie.length > 1)
                {
                    cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ''));
                }
                // note that in cases where cookie is initialized but no value, null is returned
                return cookie_value;
            }
            a_temp_cookie = null;
            cookie_name = '';
        }
        if (!b_cookie_found)
        {
            return null;
        }
    },

    arraySort : function(a, b) {
        if (a[1] < b[1]) return -1;
        if (a[1] > b[1]) return 1;
        return 0;
    },
    notNullCount : function (arr) {
        if (arr) {
            var j = 0;
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] != null) j++;
            }
            return j;
        } else {
            return 0;
        }
    },
    checkLocation : function (str) {
        var rx = new RegExp(str);
        var res = rx.exec(window.location.href);
        if (res) {
            return res.toString();
        }
    },
    getMyUid : function() {
        var id = GM_getValue("id", 0);
        var nid;
        try {
            var base = MigScript.DomUtil.ge("myprofile");
            var anchs = base.getElementsByTagName("a");
            var str = anchs[1].getAttribute("href");
            if (str != null && str.match(/\/id/)) {
                str = str.replace(/\?|\#/g, '');
                nid = str.substring(str.indexOf("/id") + 3);
            }
            if (nid != id) {
                GM_setValue("id", nid);
                return nid;
            } else {
                GM_setValue("id", id);
                return id;
            }
        } catch (e) {
            return id;
        }
    },
    trimList : function (l) {
        if (l) {
            var newList = new Array();
            for (var i = 0; i < l.length; i++) {
                if (l[i] != null) newList.push(l[i]);
            }
            //MigScript.log("newList " + newList);
            return newList;
        } else return null;
    } ,
    checkPeriod: function(timeSource, period) {
        var lastupdate = MigScript.Util.deserialize(timeSource, 0);
        var now = new Date().getTime();

        // MigScript.log("lu " +lastupdate);
        var dif = (now - lastupdate);
        // MigScript.log("dif " +dif);
        //  alert(MigScript.OnlineFriends.checkPeriod);
        if ((dif >= period) || (dif <= -period)) {
            MigScript.Util.serialize(timeSource, now);
            return true;
        } else {
            return false;
        }
    },
    serialize: function (container, source) {
        //MigScript.log("src unevaled: " + uneval(source));
        var str = MigScript.myUid + "_" + container;
        // MigScript.log(str);
        GM_setValue(str, uneval(source));
    },
    deserialize: function(container, defaultValue) {
        // MigScript.log(MigScript.myUid + "_" + container);
        var value ;
        if (defaultValue != null) {
            value = GM_getValue(MigScript.myUid + "_" + container, defaultValue);
            MigScript.log(container + " value is " + value);
            if (value == "" || value == null || value == "null") {
                value = defaultValue;
                MigScript.log(container + " value set to default " + defaultValue);
            }
        }
        else {
            value = GM_getValue(MigScript.myUid + "_" + container, null);
            MigScript.log(container + " value is " + value);
        }
        return eval(value);
    },
    foreignRequest : function(url, onDone)
    {
        MigScript.log("Request sent to " + url);
        GM_xmlhttpRequest({method:"GET",url:url,onreadystatechange:function(o) {
            if (o.readyState == 4) {
                if (onDone) {
                    MigScript.log("Response from " + url + " received");
                    onDone(o.responseText);
                }

            }
        }});
    },
    Position : function(x, y)
    {
        this.X = x;
        this.Y = y;

        this.Add = function(val)
        {
            var newPos = new Position(this.X, this.Y);
            if (val != null)
            {
                if (!isNaN(val.X))
                    newPos.X += val.X;
                if (!isNaN(val.Y))
                    newPos.Y += val.Y;
            }
            return newPos;
        };

        this.Subtract = function(val)
        {
            var newPos = new Position(this.X, this.Y);
            if (val != null)
            {
                if (!isNaN(val.X))
                    newPos.X -= val.X;
                if (!isNaN(val.Y))
                    newPos.Y -= val.Y;
            }
            return newPos;
        };

        this.Min = function(val)
        {
            var newPos = new Position(this.X, this.Y);
            if (val == null)
                return newPos;

            if (!isNaN(val.X) && this.X > val.X)
                newPos.X = val.X;
            if (!isNaN(val.Y) && this.Y > val.Y)
                newPos.Y = val.Y;

            return newPos;
        };

        this.Max = function(val)
        {
            var newPos = new Position(this.X, this.Y);
            if (val == null)
                return newPos;

            if (!isNaN(val.X) && this.X < val.X)
                newPos.X = val.X;
            if (!isNaN(val.Y) && this.Y < val.Y)
                newPos.Y = val.Y;

            return newPos;
        };

        this.Bound = function(lower, upper)
        {
            var newPos = this.Max(lower);
            return newPos.Min(upper);
        };

        this.Check = function()
        {
            var newPos = new Position(this.X, this.Y);
            if (isNaN(newPos.X))
                newPos.X = 0;
            if (isNaN(newPos.Y))
                newPos.Y = 0;
            return newPos;
        };

        this.Apply = function(element)
        {
            if (typeof(element) == "string")
                element = document.getElementById(element);
            if (element == null)
                return;
            if (!isNaN(this.X))
                element.style.left = this.X + 'px';
            if (!isNaN(this.Y))
                element.style.top = this.Y + 'px';
        };
    }
};

MigScript.DomUtil = {
    ge : function() {
        var ea;
        for (var i = 0; i < arguments.length; i++) {
            var e = arguments[i];
            if (typeof e == 'string')
                e = document.getElementById(e);
            if (arguments.length == 1)
                return e;
            if (!ea)
                ea = new Array();
            ea.push(e);
        }
        return ea;
    },
    getDescendantById: function(p, id) {
        if (typeof(p) == "string") {
            p = document.getElementById(p);
        }
        if (p == null) {
            return;
        }
        var c = p.childNodes;
        for (var i = 0; i < c.length; i++) {
            if (c[i].id == id) {
                return c[i];
            } else {

                if (c[i].childNodes.length > 0)
                    var d = MigScript.DomUtil.getDescendantById(c[i], id);
                if (d) {
                    return d;
                }
            }
        }
    },

    dc : function (tag) {
        return document.createElement(tag);
    },
    absLeft : function(element) {
        if (typeof(element) == "string")
            element = document.getElementById(element);
        if (element == null)
            return;
        var xPos = element.offsetLeft;
        var tempEl = element.offsetParent;
        while (tempEl != null) {
            xPos += tempEl.offsetLeft;
            tempEl = tempEl.offsetParent;
        }
        return xPos;

    },
    absTop : function() {
        if (typeof(element) == "string")
            element = document.getElementById(element);
        if (element == null)
            return;
        var yPos = element.offsetTop;
        var tempEl = element.offsetParent;
        while (tempEl != null) {
            yPos += tempEl.offsetTop;
            tempEl = tempEl.offsetParent;
        }
        return yPos;
    },
    geByClass :function (searchClass, node, tag) {
        var classElements = new Array();
        if (node == null)
            node = document;
        if (tag == null)
            tag = '*';
        if (node.getElementsByClassName) {
            classElements = node.getElementsByClassName(searchClass);
            if (tag != '*') {
                for (i = 0; i < classElements.length; i++) {
                    if (classElements.nodeName == tag)
                        classElements.splice(i, 1);
                }
            }
            return classElements;
        }
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
        for (var i = 0,j = 0; i < elsLen; i++) {
            if (pattern.test(els[i].className)) {
                classElements[j] = els[i];
                j++;
            }
        }
        return classElements;
    },

    toggle: function (elem) {
        if (elem.style.display == "none") {
            elem.style.display = "inherit";

        } else {
            elem.style.display = "none";

        }

    },

    removeChildNodes: function (elem) {
        var cycle_length = elem.childNodes.length;
        for (var i = 0; i < cycle_length; i++) {
            //MigScript.DomUtil.removeChildNodes(elem.childNodes[0]);
            elem.removeChild(elem.childNodes[0]);
        }
    },
    insertAfter: function (insert_node_id, after_node_id) {
        var insertA = MigScript.DomUtil.ge(after_node_id);
        var insertWhat = MigScript.DomUtil.ge(insert_node_id);
        insertA.parentNode.insertBefore(insertWhat, insertA.nextSibling);
    },
    highlight : function (elem) {
        elem.className += "_h";
    },

    unlight : function (elem) {
        elem.className = elem.className.substring(0, elem.className.indexOf("_h"));
    },

    addHighlighting : function (elem) {
        elem.addEventListener("mouseover", function() {
            MigScript.DomUtil.highlight(this);
        }, true);
        elem.addEventListener("mouseout", function() {
            MigScript.DomUtil.unlight(this);
        }, true);
    },


    hide : function (id) {
        if (MigScript.DomUtil.ge(id) != null) MigScript.DomUtil.ge(id).style.display = "none";
    },

    show : function(id) {
        if (MigScript.DomUtil.ge(id) != null) MigScript.DomUtil.ge(id).style.display = "block";
    },

    appendDiv : function (to_id, what_id) {
        var _parent = MigScript.DomUtil.ge(to_id);
        var el = MigScript.DomUtil.dc("div");
        el.id = what_id;
        _parent.appendChild(el);
        return el;
    }


};

MigScript.Friends = {
    getFriends: function (onDone, onFail) {
        MigScript.Ajax.ajax = new MigScript.Ajax.AjaxClass(
                function(a, r) {
                    r = eval("(" + r + ")");
                    // fr лежит в ответе
                    MigScript.Friends.friendList = r.friends;
                    if (onDone != null)onDone();
                },
                function() {
                    if (onFail != null) onFail();
                }
                );
        MigScript.Ajax.ajax.get("/friends.php?id=" + MigScript.myUid);
    },
    getFavFriends: function(onDone) {
        MigScript.Ajax.ajax = new MigScript.Ajax.AjaxClass(
                function(a, r) {
                    var all_id = r.match((/href=\"\/id\d+/g));
                    for (var l = 0; l < all_id.length; l++) {
                        all_id[l] = all_id[l].toString();
                        all_id[l] = all_id[l].substring("href=\"\/id".length);
                    }
                    for (var j = 0; j < all_id.length; j++) {
                        for (var k = 0; k < all_id.length; k++) {
                            if (((all_id[j] == all_id[k]) || (all_id[j] == MigScript.myUid)) && (j != k)) {
                                all_id[j] = null;
                            }
                        }
                    }
                    MigScript.Friends.favFriends = MigScript.Util.trimList(all_id);
                    MigScript.Util.serialize("favFriends", MigScript.Friends.favFriends);
                    //MigScript.log("afterTrim: " + all_id);


                    if (onDone != null)onDone();
                },
                function() {
                    if (onFail != null) onFail();
                }
                );
        MigScript.Ajax.ajax.get("/fave.php");
    },
    friendList : null,
    favFriends : null,
    isFriend : function (uid) {
        // MigScript.log(MigScript.Friends.friendList.length);
        for (var i = 0; i < MigScript.Friends.friendList.length; i++) {
            if (uid == MigScript.Friends.friendList[i][0]) {
                return true;
            }
        }
        return false;
    },
    isFavFriend : function(fid) {
        if (MigScript.Friends.favFriends) {
            for (var i = 0; i < MigScript.Friends.favFriends.length; i++) {
                if (MigScript.Friends.favFriends[i] == fid) {
                    return true;
                }
            }
        }
        return false;
    },
    init: function () {
        MigScript.Friends.friendList = MigScript.Util.deserialize("lastList", new Array());
        MigScript.Friends.favFriends = MigScript.Util.deserialize("favFriends", new Array());
        //        MigScript.Friends.friendList = ((MigScript.Friends.friendList.length > 0) ? MigScript.Friends.friendList : MigScript.Friends.getFriends());
        //        MigScript.Friends.favFriends = ((MigScript.Friends.favFriends.length > 0) ? MigScript.Friends.favFriends : MigScript.Friends.getFavFriends());
        if (MigScript.Friends.friendList.length == 0) {
            MigScript.Friends.friendList = MigScript.Friends.getFriends();
        }
        if (MigScript.Friends.favFriends.length == 0) {
            MigScript.Friends.favFriends = MigScript.Friends.getFavFriends();
        }
    }
};

MigScript.ExFriends = {

    getExList : function () {
        var _exFriends = MigScript.Util.deserialize("exFriends", "[]");
        MigScript.log("ex " + _exFriends.length);
        return MigScript.Util.trimList(_exFriends);
    },
    checkFriends : function () {
        //MigScript.log("cf");
        if (MigScript.Util.checkPeriod("last_checked", MigScript.Settings.local_settings[3] * 60 * 1000))
        {
            // MigScript.log("cp passed");
            MigScript.UI.ExFriends.showProgress();
            MigScript.UI.ExFriends.notify();
            MigScript.Friends.getFriends(MigScript.ExFriends.checkLists);
            // lastChecked = new Date().toGMTString();
            //MigScript.Util.serialize("last_checked", lastChecked);
            setTimeout(function() {
                MigScript.ExFriends.checkFriends();
            }, MigScript.Settings.local_settings[3] * 60 * 1000);
        }
    },
    forceCheckFriends : function () {
        var lastChecked = new Date(MigScript.Util.deserialize("last_checked", 0)).getTime();
        MigScript.ExFriends.exFriends = MigScript.ExFriends.getExList();
        MigScript.UI.ExFriends.showProgress();
        MigScript.Friends.getFriends(MigScript.ExFriends.checkLists);
    },
    checkLists : function () {
        if (MigScript.Friends.friendList.length != 0) {
            //MigScript.log("checkLists");

            var lastFriendList = MigScript.Util.deserialize("lastList", new Array());
            //MigScript.log(lastFriendList);
            /*if (MigScript.UI.ExFriends.isShown) {
             MigScript.DomUtil.ge("fr_txt").innerHTML = "В списке друзей всё спокойно";
             }*/

            for (var i = 0; i < lastFriendList.length; i++) {
                for (var j = 0; j < MigScript.Friends.friendList.length; j++) {
                    if (lastFriendList[i][0] == MigScript.Friends.friendList[j][0]) {
                        lastFriendList[i] = null;
                        break;
                    }
                }
            }
            for (i = 0; i < lastFriendList.length; i++) {
                if (lastFriendList[i] != null)MigScript.ExFriends.exFriends.push(lastFriendList[i]);
            }
            MigScript.ExFriends.exFriends = MigScript.Util.trimList(MigScript.ExFriends.exFriends);
            lastFriendList = MigScript.Friends.friendList;
            MigScript.Util.serialize("lastList", lastFriendList);
            MigScript.Util.serialize("exFriends", MigScript.ExFriends.exFriends);
        }
        //MigScript.log("gonna Alert");
        //MigScript.log("exFr length: "+MigScript.ExFriends.exFriends.length);
        MigScript.UI.ExFriends.alertDel(MigScript.ExFriends.exFriends.length);
        MigScript.UI.ExFriends.notify();

    },
    init: function() {
        MigScript.ExFriends.exFriends = MigScript.ExFriends.getExList();
        MigScript.ExFriends.checkFriends();
    }
};

MigScript.OnlineFriends = {
    onlineFriends : null,
    oldOnlineFriends : null,
    checkPeriod : null,
    newOnlineFriends : null,
    getOnlineFriends : function (onDone) {

        if (MigScript.Util.checkPeriod("onlUpdTime", MigScript.OnlineFriends.checkPeriod)) {
            MigScript.Ajax.ajax = new MigScript.Ajax.AjaxClass(
                    function(a, r) {
                        var resp = eval("(" + r + ")");
                        MigScript.OnlineFriends.onlineFriends = resp.friends;
                        MigScript.OnlineFriends.onlineFriends.sort(MigScript.Util.arraySort);
                        MigScript.log(MigScript.OnlineFriends.onlineFriends);
                        MigScript.Util.serialize("onlFriends", resp.friends);
                        MigScript.OnlineFriends.checkNewFriends();

                        setTimeout(function() {
                            MigScript.OnlineFriends.getOnlineFriends(function() {
                                MigScript.UI.OnlineFriends.notifyNumber();
                                MigScript.UI.OnlineFriends.addPeople();
                            });
                        }, MigScript.OnlineFriends.checkPeriod);
                        if (onDone != null)onDone();
                    },
                    function() {
                        if (onFail != null) onFail();
                    }
                    );
            MigScript.Ajax.ajax.get("/friends.php?id=" + MigScript.myUid + "&filter=online");
        } else {

            setTimeout(
                    function() {
                        MigScript.OnlineFriends.getOnlineFriends(function() {
                            MigScript.UI.OnlineFriends.notifyNumber();
                            MigScript.UI.OnlineFriends.addPeople();
                        });
                    }
                    , MigScript.OnlineFriends.checkPeriod);
            if (onDone != null)onDone();
        }
    },
    checkNewFriends : function() {
        MigScript.OnlineFriends.newOnlineFriends = new Array();
        MigScript.log("start checking new online friends");
        var flag = true;
        for (var i = 0; i < MigScript.OnlineFriends.onlineFriends.length; i++) {
            flag = true;
            for (var j = 0; j < MigScript.OnlineFriends.oldOnlineFriends.length; j++) {
                if (MigScript.OnlineFriends.onlineFriends[i][0] == MigScript.OnlineFriends.oldOnlineFriends[j][0]) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                MigScript.OnlineFriends.newOnlineFriends.push(MigScript.OnlineFriends.onlineFriends[i]);
            }
        }
        MigScript.log("online friends lists compared");
        MigScript.log("online friends lists compared");
        if (MigScript.OnlineFriends.newOnlineFriends.length > 0) {
            if (MigScript.Settings.local_settings[29]) {
                MigScript.Sound.play(MigScript.Sound.onlineSound());
            }
        }

        MigScript.OnlineFriends.oldOnlineFriends = MigScript.OnlineFriends.onlineFriends;
        MigScript.log("newonline list length: " + MigScript.OnlineFriends.newOnlineFriends.length);


        for (var k = 0; k < MigScript.OnlineFriends.newOnlineFriends.length; k++) {
            MigScript.log(MigScript.OnlineFriends.newOnlineFriends[k][1]);
            if (MigScript.Settings.local_settings[18]) {
                MigScript.alert("<b>В сети<b>", "<b><a target='_blank' href='" + MigScript.HOST + "/id" + MigScript.OnlineFriends.newOnlineFriends[k][0] + "'>" + MigScript.OnlineFriends.newOnlineFriends[k][1] + "</a></b> сейчас онлайн!");
            }
        }


    },
    init : function () {
        MigScript.OnlineFriends.onlineFriends = MigScript.Util.deserialize("onlFriends", "[]");

        MigScript.OnlineFriends.onlineFriends.sort(MigScript.Util.arraySort);


        MigScript.OnlineFriends.oldOnlineFriends = MigScript.OnlineFriends.onlineFriends;
        MigScript.OnlineFriends.checkPeriod = MigScript.Settings.local_settings[13] * 1000;
        MigScript.OnlineFriends.getOnlineFriends(MigScript.UI.OnlineFriends.init);
    }

};

MigScript.Photo = {
    markAll: function() {

        function getPhotoInfo() {
            var res;
            if (res = /([0-9\-]+)_(\d+)/.exec(location.href))
                return {"mid": res[1], "pid": res[2]};
            else return {"mid": 0, "pid": 0};
        }

        ;


        var info = getPhotoInfo();
        var pid = info["pid"], mid = info["mid"];

        function mark() {
            p_mark(0);
        }

        ;


        function p_mark(i) {
            if (i >= MigScript.Friends.friendList.length) {
                MigScript.UI.Dialog.showBlock("<font color='#00f'>Все друзья отмечены!!</font><br>Ждите перезагрузки страницы!");
                //		clearTimeout(timerID);
                setTimeout(function() {
                    window.location.reload();
                }, 10);
                return;
            }
            var uri = "/photos.php?act=put&pid=" + mid + "_" + pid + "&id=" + mid + "&oid=0&subject=" + MigScript.Friends.friendList[i][0] + "&name=" + encodeURI(MigScript.Friends.friendList[i][1]) + "&add=1&x=0&y=0&x2=100&y2=100";
            MigScript.Ajax.ajax.get(uri);
            MigScript.Ajax.ajax.onDone = function() {
                MigScript.UI.Dialog.showBlock("<font color='#00f'>" + (i + 1) + "</font> из <font color='#F00'>" + MigScript.Friends.friendList.length + "</font> друзей отмечено!");
                p_mark(i + 1);
            };
        }

        ;

        if (!confirm("Вы точно хотите отметить ВСЕХ друзей?")) return;
        MigScript.UI.Dialog.getDialog("Отмечаем друзей", true);
        MigScript.UI.getOpaqueBg();
        MigScript.UI.Dialog.showBlock("Обработка <img src=\"http://vkontakte.ru/images/upload.gif\"><br /> Ждите...");
        if (MigScript.Friends.friendList != null) {
            p_mark(0);
        } else {
            MigScript.Friends.getFriends(mark);
        }
    },


    deleteAllMarks:function () {
        var timer;
        var forDel = new Array();
        var pid = MigScript.Photo.getPhotoId();
        var ttlMarks = MigScript.Photo.getTotalMarksNumber();
        var nodes = MigScript.DomUtil.ge("phototags").getElementsByTagName("a");
        if (confirm("Точно удалить ВСЕ отметки ??")) {
            for (var i = 0; i < nodes.length; i++) {
                var str = nodes[i].getAttribute("onclick");
                if (str != null && str.match(/tagger/)) {
                    var tag_id = str.match(/\d+/);
                    forDel.push(tag_id);
                }
            }
            MigScript.UI.getOpaqueBg();
            MigScript.UI.Dialog.getDialog("Удаляем все отметки", true);
            deleteMark(0);
        }
        function deleteMark(i) {
            if (forDel.length > i) {
                MigScript.UI.Dialog.showBlock("Удаляю <font color='#00f'>" + (i + 1) + " </font> из <font color='#f00'>" + ttlMarks + " </font> отметок");
                var uri = "/photos.php";
                MigScript.Ajax.ajax.post(uri, {'act':"put",'pid':pid,'tag_id':forDel[i]});
                MigScript.Ajax.ajax.onDone = function () {
                    deleteMark(++i);
                };
            } else {
                MigScript.UI.Dialog.showBlock("<font color='#00f'>Все отметки удалены!!</font><br>Ждите перезагрузки страницы!");
                timer = setTimeout(function() {
                    window.location.reload();
                }, 3000);
            }
        }

        ;

    },

    getPhotoId : function () {
        return location.href.match(/\d+_\d+/);
    },

    getTotalMarksNumber : function () {
        var j = 0;
        var nodes;
        if (MigScript.DomUtil.ge("phototags") != null)
            nodes = MigScript.DomUtil.ge("phototags").getElementsByTagName("a");
        if (nodes != null) {
            for (var i = 0; i < nodes.length; i++) {
                if (nodes[i].getAttribute("onclick") != null && nodes[i].getAttribute("onclick").match(/tagger/)) {
                    j += 1;
                }
            }
        }
        return j;
    },

    confirmAll : function() {
        var confirm = function(pid) {
            (new MigScript.Ajax.AjaxClass()).post("/photos.php?act=a_confirm_tag", "id=" + pid);
        };

        var album = MigScript.DomUtil.ge("album");
        var a = album.getElementsByTagName("a");
        for (var i = 0; i < a.length; i++) {
            var pid;
            if (pid = a[i].href.match(/\d+_\d+/)) {
                confirm(pid.toString());
            }
        }
        MigScript.UI.Dialog.getDialog("Подтверждение завершено", true);
        MigScript.UI.Dialog.showTxt("Вы подтвердили, что присутствуете на всех фотографиях!");
        MigScript.DomUtil.ge("dlg_ok_btn").addEventListener("click", function() {
            window.location.reload();
        }, true);

    }


};

MigScript.Video = {
    getVideoUrl : function (text) {
        var vtag = /vtag:.(.*?).,/.exec(text);
        var vkid = /vkid:.(.*?).,/.exec(text);
        var host = /host:.(.*?).,/.exec(text);
        var uid = /uid:..(.*?).,/.exec(text);

        if (vtag && vkid && host) {
            //Если хост содержит тока цифры - это плохой хост =)
            // console.log(vtag[1]);
            // console.log(vkid[1]);
            // console.log(host[1]);
            // console.log(uid[1]);

            if (!host[1].match(/[^\d+]/)) {
                return "http://cs" + host[1] + ".vkontakte.ru/u" + uid[1] + "/video/" + vtag[1] + ".flv";
            }


            return "http://" + host[1] + "/assets/videos/" + vtag[1] + vkid[1] + ".vk.flv";
        } else {
            return null;
        }
    },

    markAll : function () {
        function v_mark() {
            mark(0);
        }

        ;
        function mark(i) {
            if (i >= MigScript.Friends.friendList.length) {
                MigScript.UI.Dialog.showBlock("<font color='#00f'>Все друзья отмечены!!</font><br>Ждите перезагрузки страницы!");
                //		clearTimeout(timerID);
                setTimeout(function() {
                    window.location.reload();
                }, 10);
                return;
            }
            var vid = MigScript.DomUtil.ge("video_id").value;
            var uri = "/video.php";
            MigScript.Ajax.ajax.get(uri, {'act':'aaddtag', 'fid':MigScript.Friends.friendList[i][0], 'oid':MigScript.myUid,'text':encodeURI(MigScript.Friends.friendList[i][1]),'vid':vid});
            MigScript.Ajax.ajax.onDone = function() {
                MigScript.UI.Dialog.showBlock("<font color='#00f'>" + (i + 1) + "</font> из <font color='#F00'>" + MigScript.Friends.friendList.length + "</font> друзей отмечено!");
                mark(i + 1);
            };
        }

        if (!confirm("Вы точно хотите отметить ВСЕХ друзей?")) return;
        MigScript.UI.Dialog.getDialog("Отмечаем друзей", true);
        MigScript.UI.getOpaqueBg();
        MigScript.UI.Dialog.showBlock("Обработка <img src=\"http://vkontakte.ru/images/upload.gif\"><br /> Ждите...");
        if (MigScript.Friends.friendList != null) {
            mark(0);
        } else {
            MigScript.Friends.getFriends(v_mark);
        }
    },
    deleteAllMarks:function () {
        var timer;
        var forDel = new Array();
        var vid = MigScript.DomUtil.ge("video_id").value;
        var ttlMarks = MigScript.Video.getTotalMarksNumber();
        var nodes = MigScript.DomUtil.ge("tagsCont").getElementsByTagName("a");
        if (confirm("Точно удалить ВСЕ отметки ??")) {
            for (var i = 0; i < nodes.length; i++) {
                var str = nodes[i].getAttribute("onclick");
                if (str != null && str.match(/removeTag/)) {
                    var tag_id = str.match(/\d+/);
                    forDel.push(tag_id);
                }
            }
            MigScript.UI.getOpaqueBg();
            MigScript.UI.Dialog.getDialog("Удаляем все отметки", true);
            deleteMark(0);
        }
        function deleteMark(i) {
            if (forDel.length > i) {
                MigScript.UI.Dialog.showBlock("Удаляю <font color='#00f'>" + (i + 1) + " </font> из <font color='#f00'>" + ttlMarks + " </font> отметок");
                var uri = "/video.php";
                MigScript.Ajax.ajax.post(uri, {'act':"adeletetag",'oid':MigScript.myUid,'tag_id':forDel[i], 'vid':vid});
                MigScript.Ajax.ajax.onDone = function () {
                    deleteMark(++i);
                };
            } else {
                MigScript.UI.Dialog.showBlock("<font color='#00f'>Все отметки удалены!!</font><br>Ждите перезагрузки страницы!");
                timer = setTimeout(function() {
                    window.location.reload();
                }, 3000);
            }
        }

        ;
    },
    getTotalMarksNumber : function () {
        var j = 0;
        var nodes;
        if (MigScript.DomUtil.ge("tagsCont") != null)
            nodes = MigScript.DomUtil.ge("tagsCont").getElementsByTagName("a");
        if (nodes != null) {
            for (var i = 0; i < nodes.length; i++) {
                if (nodes[i].getAttribute("onclick") != null && nodes[i].getAttribute("onclick").match(/removeTag/)) {
                    j += 1;
                }
            }
        }
        return j;
    }
};

MigScript.Audio = {
    doubles : null
};

MigScript.Sound = {
    onlineSound : function () {
        return "";
    },
    messageSound : function() {

        return "";
    },
    notifySound : function () {
        return "";
    },
    play : function(src) {
        if (MigScript.Settings.local_settings[15]) {
            var audio = MigScript.DomUtil.ge("audio_cont");
            if (audio) {
                document.body.removeChild(audio);
            }
            audio = MigScript.DomUtil.dc("audio");
            audio.id = "audio_cont";
            audio.setAttribute("autoplay", true);
            audio.src = src;
            document.body.appendChild(audio);
        }
    },
    init: function() {
        var audio = MigScript.DomUtil.ge("audio_cont");
        if (audio == null) {
            audio = MigScript.DomUtil.dc("audio");
            audio.id = "audio_cont";
            audio.setAttribute("autoplay", true);
            //audio.src = MigScript.Sound.onlineSound();
            document.body.appendChild(audio);
        }
    }
};

MigScript.Group = {
    isAdmin : function () {
        return MigScript.DomUtil.ge("section4") != null;
    },

    callFriends : function () {
        MigScript.DomUtil.ge("gr_frCall").innerHTML = "<center><img src=\"" + MigScript.UI.Images.loaderImg() + "\"/></center>";

        function doCallFriends() {
            MigScript.Ajax.ajax.get(window.location.href);
            MigScript.Ajax.ajax.onDone = function(a, r) {
                var hash = /hash:.\'\w+\'/.exec(r);
                hash = hash.toString().substring(6);
                var _hash = hash.replace(/\'/g, "");

                var _gid = window.location.href.match(/club\d+/);
                _gid = _gid.toString().substring(4);

                // MigScript.log(_hash + " " + _gid);

                var fids = new Array();
                for (var i = 1; i < MigScript.Friends.friendList.length; i++) {
                    fids[i - 1] = MigScript.Friends.friendList[i][0];
                    //MigScript.log(fids[i - 1]);
                }
                // MigScript.log(fids.join());
                MigScript.Ajax.ajax.post("groups_ajax.php?act=a_invite_friends", {friends: fids.join(), gid:_gid, hash: _hash});
                MigScript.Ajax.ajax.onDone = function(a, _r) {
                    //  MigScript.log(_r);
                    _r = eval("(" + _r + ")");
                    MigScript.DomUtil.ge("gr_frCall").innerHTML = "<b>Пригласить всех друзей</b>";
                    var rtext;
                    if (_r.result != null) {
                        rtext = "Приглашено: " + _r.result + " человек";
                    } else if (_r.error != null) {
                        rtext = "Ошибочка вышла...";
                    }
                    ;
                    MigScript.DomUtil.ge("gr_frCall").parentNode.appendChild(document.createTextNode(rtext));
                };
            };
        }

        ;

        MigScript.Friends.getFriends(doCallFriends);
    },

    kickNoFriends: function () {
        if (MigScript.Friends.friendList == null) {
            MigScript.Friends.getFriends(MigScript.Group.kickNoFriends);
        } else {
            if (!confirm("Из группы будут выгнаны все те, кто на данной странице не является вашим другом. Начнём ??")) return;
            var divs = document.getElementById("membersContainer").getElementsByTagName("div");
            var gid = window.location.href.match(/gid=\d+/).toString();
            gid = gid.match(/\d+/).toString();
            for (var i = 0; i < divs.length; i++) {
                if (/memRow/.exec(divs[i].id)) {
                    var pid = divs[i].id.slice(6);

                    var arr = divs[i].getElementsByTagName("a")[2];
                    var str = arr.getAttribute("onclick");
                    var hash;
                    if (str != null) {
                        hash = str.match(/\'\w*\'/).toString();
                        hash = hash.match(/\w+/).toString();
                    } else hash = null;
                    var flag = true;
                    for (var j = 0; j < MigScript.Friends.friendList.length; j++) {
                        if (MigScript.Friends.friendList[j][0] == pid) flag = false;
                    }
                    ;
                    if (flag && pid.length > 0) {
                        MigScript.Group.deleteMember(pid, gid, hash);

                    }
                }
                ;
            }
            ;
        }
    },
    deleteMember :function (pid, gid, hash) {
        MigScript.Ajax.ajax.post(MigScript.HOST + "/groups_ajax.php", {act: "a_delete_member", gid: gid, id:pid, hash: hash});
        MigScript.Ajax.ajax.onDone = function (r) {
            // MigScript.log(r.toString());
            eval(r);
            if (result != null) {
                //  MigScript.log(result);
                MigScript.DomUtil.ge("memRow" + pid).style.visibility = "none";
            }
        };
    }
};

MigScript.Bookmarks = {
    bookAction : function(uid) {
        MigScript.Friends.favFriends.push(uid);
        MigScript.log("friend bookmarked");
        MigScript.Util.serialize("favFriends", MigScript.Friends.favFriends);
        MigScript.UI.placeBookmarkStubs();
        MigScript.UI.OnlineFriends.createList();
        MigScript.Bookmarks.syncAdd(uid);
    },
    unbookAction: function(uid) {
        for (var i = 0; i < MigScript.Friends.favFriends.length; i++) {
            if (MigScript.Friends.favFriends[i] == uid) {
                MigScript.Friends.favFriends[i] = null;
            }
        }
        MigScript.Friends.favFriends = MigScript.Util.trimList(MigScript.Friends.favFriends);
        MigScript.log("friend unbookmarked");
        MigScript.Util.serialize("favFriends", MigScript.Friends.favFriends);
        MigScript.UI.placeBookmarkStubs();
        MigScript.UI.OnlineFriends.createList();
        MigScript.Bookmarks.syncDel(uid);
    },

    fullSyncAdd : function() {
        for (var i = 0; i < MigScript.Friends.favFriends.length; i++) {
            var uid = MigScript.Friends.favFriends[i];
            MigScript.Ajax.ajax.onDone = function (a, r) {
                var hash = r.match(/value=\"\w+\"/g);
                hash = hash[1].toString().replace(/\"/g, "");
                hash = hash.toString().replace(/value=/, "");
                MigScript.Ajax.ajax.get("/fave.php", {'act':'addPerson', 'mid': uid, hash: hash});
            };
            MigScript.Ajax.ajax.get(MigScript.HOST + "/id" + uid);
        }
        MigScript.log("bookmarks add sync");
    },
    fullSyncDel : function() {
        for (var i = 0; i < MigScript.Friends.favFriends.length; i++) {
            var uid = MigScript.Friends.favFriends[i];
            MigScript.Ajax.ajax.onDone = function (a, r) {
                var hash = r.match(/value=\"\w+\"/g);
                hash = hash[1].toString().replace(/\"/g, "");
                hash = hash.toString().replace(/value=/, "");
                MigScript.Ajax.ajax.get("/fave.php", {'act':'deletePerson', 'mid': uid, hash: hash});
            };
            MigScript.Ajax.ajax.get(MigScript.HOST + "/id" + uid);
        }
        MigScript.log("bookmarks del sync");
    },
    syncAdd : function(uid) {
        MigScript.Ajax.ajax.onDone = function (a, r) {
            var hash = r.match(/value=\"\w+\"/g);
            hash = hash[1].toString().replace(/\"/g, "");
            hash = hash.toString().replace(/value=/, "");
            MigScript.Ajax.ajax.get("/fave.php", {'act':'addPerson', 'mid': uid, hash: hash});
        };
        MigScript.Ajax.ajax.get(MigScript.HOST + "/id" + uid);
        MigScript.log("sync add");
    },
    syncDel : function(uid) {
        MigScript.Ajax.ajax.onDone = function (a, r) {
            var hash = r.match(/value=\"\w+\"/g);
            hash = hash[1].toString().replace(/\"/g, "");
            hash = hash.toString().replace(/value=/, "");
            MigScript.Ajax.ajax.get("/fave.php", {'act':'deletePerson', 'mid': uid, hash: hash});
        };
        MigScript.Ajax.ajax.get(MigScript.HOST + "/id" + uid);
        MigScript.log("sync del");
    }
};

MigScript.Menu = {
    imgActions : new Array(),
    menuAttrs: null,
    loadMenuAttrs : function () {
        return[
            {
                label:"Открыть контакт в новом окне",
                img: MigScript.UI.Images.visitImg(),
                url:null,
                action: function(uid) {
                    MigScript.Menu.visitAction(uid);
                },
                forFriend:null
            },
            {
                label:"Отправить сообщение",
                img: MigScript.UI.Images.mailImg(),
                url:MigScript.HOST + "/mail.php?act=write&to=",
                action: null,
                forFriend:null
            },
            {
                label:"Отправить сообщение через VkIM",
                img: MigScript.UI.Images.IMImg(),
                url:null,
                action: function(uid) {
                    window.open("/im.php?act=a_box&popup=1&sel=" + uid + "", "_blank", "location=no,width=610,height=465,top=100");
                },
                forFriend:true
            },
            {
                label:"Добавить в друзья",
                img:MigScript.UI.Images.addImg(),
                url:null,
                action: function(uid) {
                    MigScript.Menu.addAction(uid);
                },
                forFriend: false
            },
            {
                label:"Глянуть фото с пользователем",
                img:MigScript.UI.Images.photoImg(),
                url:MigScript.HOST + "/photos.php?act=user&id=",
                action: null,
                forFriend: null
            },
            {
                label:"Фотольбомы пользователя",
                img:MigScript.UI.Images.albumImg(),
                url:MigScript.HOST + "/albums",
                action: null,
                forFriend: null
            },
            {
                label:"Видео пользователя",
                img:MigScript.UI.Images.videoImg(),
                url:MigScript.HOST + "/video.php?id=",
                action: null,
                forFriend: null
            },
            {
                label:"В избранное!",
                img:MigScript.UI.Images.bookmarkAddImg(),
                url:null,
                action: function(uid, e) {
                    MigScript.Menu.book(uid, e);
                },
                forFriend: null,
                forFav: false
            },
            {
                label:"Убрать из избранного",
                img:MigScript.UI.Images.bookmarkDelImg(),
                url:null,
                action: function(uid, e) {
                    MigScript.Menu.unbook(uid, e);
                },
                forFriend: null,
                forFav: true
            },
            {
                label:"Удалить из друзей",
                img:MigScript.UI.Images.deleteImg(),
                url:null,
                action: function(uid) {
                    MigScript.Menu.delAction(uid);
                },
                forFriend: true
            },
            {
                label:"Забанить этого урода",
                img:MigScript.UI.Images.warningImg(),
                url:"/settings.php?act=addToBlackList&uid=",
                action:null,
                forFriend: null
            }

        ];
    },

    delAction : function (uid) {
        MigScript.Ajax.ajax.onDone = function (a, r) {
            MigScript.UI.showDFDialog(r, uid);
        };
        MigScript.Ajax.ajax.get(MigScript.HOST + "/friends_ajax.php?act=remove_box&fid=" + uid);
        MigScript.Friends.getFriends();
    },

    addAction : function (uid) {
        MigScript.Ajax.ajax.get("friends_ajax.php?act=request_form&fid=" + uid);
        MigScript.Ajax.ajax.onDone = function(a, r) {
            var s = eval("(" + r + ")");
            MigScript.UI.showAFDialog(s.text, uid);
            MigScript.DomUtil.ge("privacy_control").style.display = "none";
        };
    },
    visitAction : function (uid) {
        window.open(MigScript.HOST + "/id" + uid);
    },

    acceptFriend: function () {
        var form = MigScript.DomUtil.ge('addFriendForm');
        if (!form) return;
        var params = {act:MigScript.DomUtil.ge("act").value, fid:MigScript.DomUtil.ge("fid").value,hash:MigScript.DomUtil.getDescendantById("addFriendForm", "hash").value, verbose:1, message: MigScript.DomUtil.ge("addMsgBox").childNodes[3].value};
        MigScript.Ajax.ajax.post("/friends_ajax.php", params);
        MigScript.Ajax.ajax.onDone = function(ajax, responseText) {
            try {
                var response = eval('(' + responseText + ')');
                responseText = response.result || response.error || response.text;
                // MigScript.log(responseText);
                MigScript.UI.Dialog.destroyDlg();
            } catch (e) {
            }
        };
    },
    book : function(uid, e) {
        MigScript.Bookmarks.bookAction(uid);
        var el = e.target;
        var parent = el.parentNode;
        parent.removeChild(el);
        el = MigScript.DomUtil.dc("img");
        el.title = "Удалить из избранного";
        el.src = MigScript.UI.Images.bookmarkDelImg();
        el.style.cursor = "pointer";
        el.className = "menu_button";
        el.addEventListener("click", function(ex) {
            MigScript.Menu.unbook(uid, ex);
        }, false);
        parent.appendChild(el);
    },
    unbook : function(uid, e) {
        MigScript.Bookmarks.unbookAction(uid);
        var el = e.target;
        var parent = el.parentNode;
        parent.removeChild(el);
        el = MigScript.DomUtil.dc("img");
        el.title = "В избранное!";
        el.src = MigScript.UI.Images.bookmarkAddImg();
        el.style.cursor = "pointer";
        el.className = "menu_button";
        el.addEventListener("click", function(ex) {
            MigScript.Menu.book(uid, ex);
        }, false);
        parent.appendChild(el);
    },

    declineFriend :function (uid) {
        MigScript.Ajax.ajax.get(MigScript.HOST + "/friends.php");
        MigScript.Ajax.ajax.onDone = function(a, r) {
            //r = r.match(/\'hash\':\'\w+\'/);
            var fdata = eval("(" + r + ")");
            // console.log("fdata" + fdata);
            var friendHash = fdata.hash;
            //	MigScript.log(friendHash);
            MigScript.Ajax.ajax.post(MigScript.HOST + "/friends_ajax.php", {fid: uid, act: 'decline_friend', hash: friendHash});
            MigScript.Ajax.ajax.onDone = function () {
                //    MigScript.log(eval(r))
            };
            MigScript.UI.Dialog.destroyDlg();
        };
    },

    init: function() {
        MigScript.Menu.menuAttrs = MigScript.Menu.loadMenuAttrs();
    }
};

MigScript.WhoFaved = {
    favedList : null,
    getList : function(onDone) {
        var url = "http://userapi.com/data?act=faved&from=0&to=10000&sid=" + MigScript.Util.getCookie("remixsid");
        MigScript.Util.foreignRequest(url, function(r) {
            var a = eval("(" + r + ")");
            MigScript.WhoFaved.favedList = a.d;
            MigScript.Util.serialize("whoFaved", a.d);
            MigScript.log(MigScript.WhoFaved.favedList);
            if (onDone) {
                onDone();
            }
        });
    },
    init : function () {
        MigScript.WhoFaved.favedList = MigScript.Util.deserialize("whoFaved", null);
        if (MigScript.Settings.local_settings[33]) {
            MigScript.UI.WhoFaved.init();
        }

    }
};

MigScript.FavContainer = {
    favGroups : null,
    favFriends : null,
    getFavGroups : function(onDone) {
        var ajax = new MigScript.Ajax.AjaxClass();
        ajax.get(MigScript.HOST + "/fave.php");
        ajax.onDone = function(a, r) {
            MigScript.FavContainer.favGroups = r.match(/<a href=.\/club\d+.>.+<\/a>/g).toString().split("</span></li><li><span>");
            MigScript.Util.serialize("favGroups", MigScript.FavContainer.favGroups);
        };
        if (onDone) {
            onDone();
        }
    },
    getFavFriends : function(onDone) {
        var url = "http://userapi.com/data?act=fave&from=0&to=100000&sid=" + MigScript.Util.getCookie("remixsid");
        MigScript.Util.foreignRequest(url, function(r) {
            var a = eval("(" + r + ")");
            MigScript.FavContainer.favFriends = a.d;
            MigScript.Util.serialize("CfavFriends", a.d);
            MigScript.log(MigScript.WhoFaved.favedList);
            if (onDone) {
                onDone();
            }
        });
    },
    init: function() {
        MigScript.FavContainer.favGroups = MigScript.Util.deserialize("favGroups", null);
        if (!MigScript.FavContainer.favGroups) {
            MigScript.FavContainer.getFavGroups();
        }

        MigScript.FavContainer.favFriends = MigScript.Util.deserialize("CfavFriends", null);
        if (!MigScript.FavContainer.favFriends) {
            MigScript.FavContainer.getFavFriends();
        }
        MigScript.UI.FavContainer.init();
    }
};

MigScript.UI.FavContainer = {
    grIsShown : null,
    favIsShown : null,
    grContainer : null,
    favContainer : null,
    openGrContainer : function(e) {
        MigScript.Util.serialize("fg_isShown", true);
        MigScript.UI.FavContainer.grIsShown = true;
        var el = MigScript.DomUtil.ge("favGroup");
        if (!el) {
            var x,y;
            if (e) {
                x = e.pageX - 30;
                y = e.pageY - 50;
            } else {
                x = MigScript.Util.deserialize("favGroup_x", 0);
                y = MigScript.Util.deserialize("favGroup_y", 0);
            }
            MigScript.UI.FavContainer.grContainer = new MigScript.CustomObjects.FloaterClass(x, y, "favGroup", "Группы", {minWidth: 105, width: MigScript.Util.deserialize("favGroup_W", 0) ,height: MigScript.Util.deserialize("favGroup_H", 0)});
            MigScript.UI.FavContainer.grContainer.onClose = function() {
                MigScript.Util.serialize("fg_isShown", false);
                MigScript.UI.FavContainer.grIsShown = false;
            };

            var a = MigScript.DomUtil.dc("a");
            a.style.cursor = "pointer";
            a.addEventListener("click", function() {
                this.innerHTML = "<img src=\"" + MigScript.UI.Images.loaderImg() + "\"/>";
                MigScript.FavContainer.getFavGroups(function() {
                    MigScript.UI.FavContainer.grContainer.txt.childNodes[0].innerHTML = "[Обновить]";
                    MigScript.UI.FavContainer.addGroups();
                });
            }, true);
            a.innerHTML = "[Обновить]";

            MigScript.UI.FavContainer.grContainer.wrapCont.style.setProperty("width", "140px", "important");
            MigScript.UI.FavContainer.grContainer.txt.appendChild(a);
        } else {
            MigScript.UI.FavContainer.grContainer.wrapCont.style.setProperty("display", "block", "important");
        }

    },
    openFavContainer : function(e) {
        MigScript.Util.serialize("ff_isShown", true);
        MigScript.UI.FavContainer.favIsShown = true;
        var el = MigScript.DomUtil.ge("favFriends");
        if (!el) {
            var x,y;
            if (e) {
                x = e.pageX - 30;
                y = e.pageY - 50;
            } else {
                x = MigScript.Util.deserialize("favFriends_x", 0);
                y = MigScript.Util.deserialize("favFriends_y", 0);
            }
            MigScript.UI.FavContainer.favContainer = new MigScript.CustomObjects.FloaterClass(x, y, "favFriends", "Друзья", {minWidth:105, width: MigScript.Util.deserialize("favFriends_W", 0) ,height: MigScript.Util.deserialize("favFriends_H", 0)});
            MigScript.UI.FavContainer.favContainer.onClose = function() {
                MigScript.Util.serialize("ff_isShown", false);
                MigScript.UI.FavContainer.favIsShown = false;
            };

            var a = MigScript.DomUtil.dc("a");
            a.style.cursor = "pointer";
            a.addEventListener("click", function() {
                this.innerHTML = "<img src=\"" + MigScript.UI.Images.loaderImg() + "\"/>";
                MigScript.FavContainer.getFavFriends(function() {
                    MigScript.UI.FavContainer.favContainer.txt.childNodes[0].innerHTML = "[Обновить]";
                    MigScript.UI.FavContainer.addFriends();
                });
            }, true);
            a.innerHTML = "[Обновить]";

            MigScript.UI.FavContainer.favContainer.wrapCont.style.setProperty("width", "140px", "important");
            MigScript.UI.FavContainer.favContainer.txt.appendChild(a);
        } else {
            MigScript.UI.FavContainer.favContainer.wrapCont.style.setProperty("display", "block", "important");
        }

    },
    addGroups : function() {
        if (MigScript.UI.FavContainer.grIsShown) {
            var div = MigScript.UI.FavContainer.grContainer.body;
            MigScript.DomUtil.removeChildNodes(div);
            if (MigScript.FavContainer.favGroups) {
                for (var i = 1; i <= MigScript.FavContainer.favGroups.length; i++) {
                    var ndiv = MigScript.DomUtil.dc("div");
                    ndiv.id = "nd" + i;
                    //Используем стиль модуля слежения за друзьями
                    ndiv.className = "fr_pad";
                    var c_link = MigScript.DomUtil.dc("div");
                    c_link.className = "floater_link";


                    ndiv.innerHTML = MigScript.FavContainer.favGroups[i - 1];

                    ndiv.addEventListener("mouseover", function() {
                        MigScript.DomUtil.highlight(this);
                    }, true);
                    ndiv.addEventListener("mouseout", function() {
                        MigScript.DomUtil.unlight(this);
                    }, true);
                    div.appendChild(ndiv);

                }
            }
        }
    },
    addFriends : function() {
        if (MigScript.UI.FavContainer.favIsShown) {
            var div = MigScript.UI.FavContainer.favContainer.body;
            MigScript.DomUtil.removeChildNodes(div);
            if (MigScript.FavContainer.favFriends) {
                for (var i = 1; i <= MigScript.FavContainer.favFriends.length; i++) {
                    var ndiv = MigScript.DomUtil.dc("div");
                    ndiv.id = "nd" + i;
                    //Используем стиль модуля слежения за друзьями
                    ndiv.className = "fr_pad";
                    var c_link = MigScript.DomUtil.dc("div");
                    c_link.className = "floater_link";


                    var link = MigScript.DomUtil.dc("a");
                    var uid = MigScript.FavContainer.favFriends[i - 1][0];
                    link.href = MigScript.HOST + "/id" + uid;
                    link.innerHTML = MigScript.FavContainer.favFriends[i - 1][1];
                    //link.style.color = "#0000ff";
                    //link.target = "_top";
                    c_link.appendChild(link);
                    ndiv.appendChild(c_link);
                    link.addEventListener("mouseover", function(e) {
                        var uid = this.href.substring(this.href.indexOf("/id") + 3);
                        MigScript.UI.showAvatar(uid, e.clientX, 150, e.pageY, MigScript.UI.FavContainer.favContainer.body.style.width, MigScript.FavContainer.favFriends);
                    }, true);
                    link.addEventListener("mouseout", function(e) {
                        var uid = this.href.substring(this.href.indexOf("/id") + 3);
                        MigScript.UI.hideAvatar(uid);
                    }, true);
                    c_link.appendChild(link);
                    ndiv.appendChild(c_link);

                    ndiv.addEventListener("mouseover", function() {
                        MigScript.DomUtil.highlight(this);
                    }, true);
                    ndiv.addEventListener("mouseout", function() {
                        MigScript.DomUtil.unlight(this);
                    }, true);
                    div.appendChild(ndiv);

                }
            }
        }
    },
    init : function () {
        MigScript.UI.FavContainer.grIsShown = MigScript.Util.deserialize("fg_isShown", false);
        if (MigScript.UI.FavContainer.grIsShown) {
            MigScript.UI.FavContainer.openGrContainer();
            MigScript.UI.FavContainer.addGroups();
        }
        MigScript.UI.FavContainer.favIsShown = MigScript.Util.deserialize("ff_isShown", false);
        if (MigScript.UI.FavContainer.favIsShown) {
            MigScript.UI.FavContainer.openFavContainer();
            MigScript.UI.FavContainer.addFriends();
        }
    }
};

/*MigScript.Invisibility = {
 setInvisible : function() {
 var cookie = document.cookie;

 GM_xmlhttpRequest({method:"GET",url:'http://login.vk.com/?act=logout&vk=',onreadystatechange:function(o) {
 MigScript.log("invis request sent");
 if (o.readyState == 4) {
 var aCookie = cookie.split("; ");
 for (var i = 0; i < aCookie.length; i++)
 {
 var aCrumb = aCookie[i].split("=");
 var cookieName = aCrumb[0];
 var cookieValue = unescape(aCrumb[1]);

 if (cookieName == 'remixsid') {
 var today = new Date();
 var expire = new Date();
 expire.setTime(today.getTime() + 3600000 * 24 * 365);
 document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString() + '; path=/; domain=.vkontakte.ru';
 }

 cookie = '';

 }
 }
 }});
 }
 };*/

MigScript.Watcher = {
    pool : null,
    notifiedPool: {"friends":{"count":0},"messages":{"count":0},"events":{"count":0},"groups":{"count":0},"photos":{"count":0},"videos":{"count":0},"notes":{"count":0}},
    elements : null,
    watchAjax: new MigScript.Ajax.AjaxClass(),
    seekElement: function(href) {
        for (var i = 0; i < MigScript.Watcher.elements.length; i++) {
            if (MigScript.Watcher.elements[i].href.match(new RegExp(href))) {
                return MigScript.Watcher.elements[i];
            }
        }
        return null;
    },
    stripElement: function(el) {
        var els = el.innerHTML.split(" ");

        if (els[els.length - 1].match(/\[.+\]/)) {
            el.innerHTML = "";
            for (var i = 0; i < els.length - 1; i++) {
                if (els[i].match(/\(.+\)/)) {
                    els[i] = "";
                }
                el.innerHTML += els[i] + " ";
            }
        }
    },
    injectNumber: function(el, n) {
        if (el) {
            MigScript.Watcher.stripElement(el);
            if (n > 0) {
                el.innerHTML += " [<b>" + n + "</b>]";
            }
        }
    },
    makeRequest : function() {
        var uri = '/feed2.php?mask=255';
        MigScript.Watcher.watchAjax.get(uri);
        MigScript.Watcher.watchAjax.onDone = function(a, r) {
            r = "(" + r + ")";
            MigScript.Watcher.pool = eval(r);
            try {
                if (MigScript.Watcher.pool.user.id == -1) {
                    MigScript.Watcher.pool = null;
                }
            } catch(e) {
            }
            ;
            MigScript.log(MigScript.Watcher.pool);
            MigScript.Util.serialize("watcherPool", MigScript.Watcher.pool);

            MigScript.Watcher.update();
            MigScript.Watcher.compare();

        };
    },
    compare : function() {
        if (MigScript.Watcher.pool) {
            if (MigScript.Watcher.pool.photos.count < MigScript.Watcher.notifiedPool.photos.count) {
                MigScript.Watcher.notifiedPool.photos.count = MigScript.Watcher.pool.photos.count;
            }
            if (MigScript.Watcher.pool.videos.count < MigScript.Watcher.notifiedPool.videos.count) {
                MigScript.Watcher.notifiedPool.videos.count = MigScript.Watcher.pool.videos.count;
            }
            if (MigScript.Watcher.pool.messages.count < MigScript.Watcher.notifiedPool.messages.count) {
                MigScript.Watcher.notifiedPool.messages.count = MigScript.Watcher.pool.messages.count;
            }
            if (MigScript.Watcher.pool.friends.count < MigScript.Watcher.notifiedPool.friends.count) {
                MigScript.Watcher.notifiedPool.friends.count = MigScript.Watcher.pool.friends.count;
            }
            if (MigScript.Watcher.pool.notes.count < MigScript.Watcher.notifiedPool.notes.count) {
                MigScript.Watcher.notifiedPool.notes.count = MigScript.Watcher.pool.notes.count;
            }
            if (MigScript.Watcher.pool.groups.count < MigScript.Watcher.notifiedPool.groups.count) {
                MigScript.Watcher.notifiedPool.groups.count = MigScript.Watcher.pool.groups.count;
            }
            if (MigScript.Watcher.pool.events.count < MigScript.Watcher.notifiedPool.events.count) {
                MigScript.Watcher.notifiedPool.events.count = MigScript.Watcher.pool.events.count;
            }
        }
        //console.log(MigScript.Watcher.notifiedPool);
    },
    update : function() {

        var el;
        var n;
        if (MigScript.Watcher.pool != null) {

            if ((n = MigScript.Watcher.pool.friends.count) >= 0) {
                el = MigScript.Watcher.seekElement("friends.php");
                MigScript.Watcher.injectNumber(el, n);

            }
            if ((n = MigScript.Watcher.pool.photos.count) >= 0) {
                el = MigScript.Watcher.seekElement("photos.php");

                MigScript.Watcher.injectNumber(el, n);
            }
            if ((n = MigScript.Watcher.pool.videos.count) >= 0) {
                el = MigScript.Watcher.seekElement("video.php");
                MigScript.Watcher.injectNumber(el, n);
            }
            if ((n = MigScript.Watcher.pool.messages.count) >= 0) {
                el = MigScript.Watcher.seekElement("mail.php");
                MigScript.Watcher.injectNumber(el, n);
            }
            if ((n = MigScript.Watcher.pool.notes.count) >= 0) {
                el = MigScript.Watcher.seekElement("notes.php");
                MigScript.Watcher.injectNumber(el, n);
            }
            if ((n = MigScript.Watcher.pool.groups.count) >= 0) {
                el = MigScript.Watcher.seekElement("groups.php");
                MigScript.Watcher.injectNumber(el, n);
            }
            if ((n = MigScript.Watcher.pool.events.count) >= 0) {
                el = MigScript.Watcher.seekElement("events.php");
                MigScript.Watcher.injectNumber(el, n);
            }

            if ((MigScript.Watcher.pool.friends.count - MigScript.Watcher.notifiedPool.friends.count) > 0) {
                MigScript.Watcher.notifyFriends((MigScript.Watcher.pool.friends.count - MigScript.Watcher.notifiedPool.friends.count));
            }
            if ((MigScript.Watcher.pool.photos.count - MigScript.Watcher.notifiedPool.photos.count) > 0) {
                MigScript.Watcher.notifyPhotos((MigScript.Watcher.pool.photos.count - MigScript.Watcher.notifiedPool.photos.count));
            }
            if ((MigScript.Watcher.pool.videos.count - MigScript.Watcher.notifiedPool.videos.count) > 0) {
                MigScript.Watcher.notifyVideos((MigScript.Watcher.pool.videos.count - MigScript.Watcher.notifiedPool.videos.count));
            }
            if ((MigScript.Watcher.pool.messages.count - MigScript.Watcher.notifiedPool.messages.count) > 0) {
                MigScript.Watcher.notifyMessages((MigScript.Watcher.pool.messages.count - MigScript.Watcher.notifiedPool.messages.count));
            }
            if ((MigScript.Watcher.pool.notes.count - MigScript.Watcher.notifiedPool.notes.count) > 0) {
                MigScript.Watcher.notifyNotes((MigScript.Watcher.pool.notes.count - MigScript.Watcher.notifiedPool.notes.count));
            }
            if ((MigScript.Watcher.pool.groups.count - MigScript.Watcher.notifiedPool.groups.count) > 0) {
                MigScript.Watcher.notifyGroups((MigScript.Watcher.pool.groups.count - MigScript.Watcher.notifiedPool.groups.count));
            }
            if ((MigScript.Watcher.pool.events.count - MigScript.Watcher.notifiedPool.events.count) > 0) {
                MigScript.Watcher.notifyEvents((MigScript.Watcher.pool.events.count - MigScript.Watcher.notifiedPool.events.count));
            }
            MigScript.Util.serialize("notifiedPool", MigScript.Watcher.notifiedPool);
        }
    },
    notifyFriends:function(n) {

        if (MigScript.Settings.local_settings[23]) {
            if (n > 4) {
                MigScript.alert("Дружба", "У вас <b>" + n + "</b> новых заявок на дружбу", 'friends');
            } else if (n == 1) {
                MigScript.alert("Дружба", "У вас <b>" + n + "</b> новая заявка на дружбу", 'friends');
            } else if (n <= 4) {
                MigScript.alert("Дружба", "У вас <b>" + n + "</b> новые заявки на дружбу", 'friends');
            }
        }
        MigScript.Watcher.notifiedPool.friends.count += n;
        if (MigScript.Settings.local_settings[31]) {
            MigScript.Sound.play(MigScript.Sound.notifySound());
        }
    },
    notifyPhotos : function(n) {

        MigScript.Watcher.notifiedPool.photos.count += n;
        if (MigScript.Settings.local_settings[24]) {
            var arr = MigScript.Watcher.pool.photos.items;
            for (q in arr) {
                var msg = "<b>" + arr[q] + "</b> отметил вас на <a class='alertlink' href='photos.php?act=show&added=1&id=" + q +"'>фото</a>";
                MigScript.alert("Отметка", msg, 'media');
            }
        }
        if (MigScript.Settings.local_settings[31]) {
            MigScript.Sound.play(MigScript.Sound.notifySound());
        }

    },
    notifyVideos : function(n) {

        MigScript.Watcher.notifiedPool.videos.count += n;
        if (MigScript.Settings.local_settings[25]) {
           var arr = MigScript.Watcher.pool.videos.items;
            for (q in arr) {
                var msg = "<b>" + arr[q] + "</b> отметил вас на <a class='alertlink' href='video" + q + "?tagged_id="+MigScript.myUid+"'>видео</a>";
                MigScript.alert("Отметка", msg, 'media');
            }
        }
        if (MigScript.Settings.local_settings[31]) {
            MigScript.Sound.play(MigScript.Sound.notifySound());
        }

    },
    notifyMessages : function(n) {

        MigScript.Watcher.notifiedPool.messages.count += n;
        if (MigScript.Settings.local_settings[17]) {
            var arr = MigScript.Watcher.pool.messages.items;
            for (q in arr) {
                var msg = "<b>" + arr[q] + "</b> написал вам <a class='alertlink' href='mail.php?act=show&id=" + q + "'>сообщение</a>"
                MigScript.alert("Сообщение", msg, 'message');
            }
        }
        if (MigScript.Settings.local_settings[30]) {
            MigScript.Sound.play(MigScript.Sound.messageSound());
        }
    },
    notifyNotes : function(n) {

        MigScript.Watcher.notifiedPool.notes.count += n;
        if (MigScript.Settings.local_settings[26]) {

            if (n > 4) {
                MigScript.alert("Заметки", "У вас <b>" + n + "</b> новых комментариев в заметках", 'event');
            } else if (n == 1) {
                MigScript.alert("Заметки", "У вас <b>" + n + "</b> новый комментарий в заметках", 'event');
            } else if (n <= 4) {
                MigScript.alert("Заметки", "У вас <b>" + n + "</b> новых комментария в заметках", 'event');
            }


        }
        if (MigScript.Settings.local_settings[31]) {
            MigScript.Sound.play(MigScript.Sound.notifySound());
        }

    },
    notifyGroups : function(n) {

        MigScript.Watcher.notifiedPool.groups.count += n;
        if (MigScript.Settings.local_settings[27]) {

            var arr = MigScript.Watcher.pool.groups.items;
            for (q in arr) {
                var msg = "Вас пригласили в группу <a class='alertlink' href='club" + q + "'>" + arr[q] + "</a>"
                MigScript.alert("Приглашение", msg, 'event');
            }


        }
        if (MigScript.Settings.local_settings[31]) {
            MigScript.Sound.play(MigScript.Sound.notifySound());
        }
    },
    notifyEvents : function(n) {

        MigScript.Watcher.notifiedPool.events.count += n;
        if (MigScript.Settings.local_settings[28]) {

            var arr = MigScript.Watcher.pool.events.items;
            for (q in arr) {
                var msg = "Вас пригласили на мероприятие <a class='alertlink' href='events.php?act=s&gid=" + q + "'>" + arr[q] + "</a>"
                MigScript.alert("Приглашение", msg, 'event');
            }

        }
        if (MigScript.Settings.local_settings[31]) {
            MigScript.Sound.play(MigScript.Sound.notifySound());
        }


    },
    loop : function() {
        MigScript.Watcher.makeRequest();
        setTimeout(function() {
            MigScript.Watcher.loop();
        }, MigScript.Settings.local_settings[20] * 1000);
    },



    init: function() {
        var nav = MigScript.DomUtil.ge("nav");
        if (nav) {
            MigScript.Watcher.elements = nav.getElementsByTagName("a");
            // MigScript.Watcher.resetElements();
            MigScript.Watcher.notifiedPool = MigScript.Util.deserialize("notifiedPool", MigScript.Watcher.notifiedPool);

            MigScript.Watcher.pool = MigScript.Util.deserialize("watcherPool", {"friends":{"count":0},"messages":{"count":0},"events":{"count":0},"groups":{"count":0},"photos":{"count":0},"videos":{"count":0},"notes":{"count":0}});
            try {
                if (MigScript.Watcher.pool.user.id == -1) {
                    MigScript.Watcher.pool = null;
                }
            } catch(e) {
            }
            ;
            MigScript.Watcher.update();
            MigScript.Watcher.compare();
            MigScript.Watcher.loop();
        }
    }
};
try {
    MigScript.init();
    MigScript.registerGlobal();
} catch(e) {
    console.log(e);
}